If you lose any of your user passwords – including root you can change your password booting into single user mode. What you aren’t likely to find off the bat is the proper instructions to do it. They are out there, but chances are you will have to dig a little after some frustration. The main differece between all those super simple solutions and the one mentioned here is that you need to remount the OS drive in order to properly write your changes. This method has worked with the last three major releases of Ubuntu including Feisty. So, here’s the procedure…
Scroll down for simplified instructions!
- Reboot, when the message from GRUB comes up, hit Escape to view the boot menu.
- Scroll down to the first like with “Recovery Mode” in the title ane hit “e” to edit that boot line.
- Select the like that starts with “kernel”, hit “e” to edit.
- At the end of the line, the option “single” should already be there, leave a space after single and add “init=/bin/bash” this makes it so that you immediately are dumped to a root command line.
- Hit Enter, then “b” to boot. Wait to boot and be left at a root console – it will look like “root@(none):/#“.
- Remount the OS partition so that it’s writable (in this example “hda1” – maybe “sda1” or otherwise) with the command “mount /dev/hda1/ -o remount,rw”
- From there you can issue the command “passwd <username>” or just “passwd” for the root user password and you can enter the new password for the user and reboot.
- Hit escape to enter GRUB menu.
- Hit “e” on the first recovery boot line.
- Select the line beginning with “kernel” and hit “e”
- Leave a space after “single” and add “init=/bin/bash”
- Hit Enter then “b” to boot.
- Wait to boot and be dumped at a root console.
- Remount the OS partition “mount /dev/hda1 / -o remount,rw”
- Use “passwd <username>” to change the user password .
I take no credit for this procedure, I definitely wouldn’t be able to figure that all out on my own.