Find your Mac OS X setup CD and boot from that by holding the "C" key while powering on. In this setup disc is a password reset utility (once the first installer screen loads, you will be able to get it from the menus at the top of the screen). Try resetting the password from there.
If all else fails, you can do an "Archive and Install" which will preserve all of the files already on the machine. Or, if you have access to another Mac, use "Firewire Target Disck Mode" to access the drive of your borked system and bring the files over.
And in future:
- If something is important back it up. If something is really important, back it up twice!
- There is no reason at all why you should need to change passwords in the Terminal, or indeed access the terminal at all.
- iMac G5 1.8GHZ 17" | SuperDrive | 160GB | 512MB | Airport Extreme | Bluetooth Keyboard & Mouse | Wacom Intuos II
- Pentax *ist DL - JVC MiniDV Camcorder - Airport Express - iPod Nano 1gb white