The REAL Way to Change Lost Passwords in Ubuntu

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!

  1. Reboot, when the message from GRUB comes up, hit Escape to view the boot menu.
  2. Scroll down to the first like with “Recovery Mode” in the title ane hit “e” to edit that boot line.
  3. Select the like that starts with “kernel”, hit “e” to edit.
  4. 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.
  5. Hit Enter, then “b” to boot. Wait to boot and be left at a root console – it will look like “root@(none):/#.
  6. 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”
  7. 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.

Simplified instructions:

  1. Hit escape to enter GRUB menu.
  2. Hit “e” on the first recovery boot line.
  3. Select the line beginning with “kernel” and hit “e”
  4. Leave a space after “single” and add “init=/bin/bash”
  5. Hit Enter then “b” to boot.
  6. Wait to boot and be dumped at a root console.
  7. Remount the OS partition “mount /dev/hda1 / -o remount,rw”
  8. Use “passwd <username>” to change the user password .
  9. Reboot.

I take no credit for this procedure, I definitely wouldn’t be able to figure that all out on my own.

Leave a Reply

Your email address will not be published. Required fields are marked *