Linux Password Recovery

(Ubuntu/Kubuntu only - I'll research this a little more and amend these instructions to apply to other versions)

OK so you've forgotten your password, and can't get into your Linux setup. What do you do?

Don't panic! The main user-account password is also the root password. So long as you know the main user account log-in name, you're laughing.

So you need just two things.

  1. Main user account name (that's the name in the log-in box just above where you're supposed to put the password)
  2. The Escape (Esc) key

Make sure you have those now, then boot the computer.

If you don't know the main user account name, don't worry - we CAN find that out!

As the computer boots, you will see a DOS-like message saying Grub… and a countdown timer going from 2 through 1 to zero.

The computer will then boot into the default operating system - usually Linux.

Whilst you can see Grub displayed quickly press the Esc key before the full boot starts - this gives more boot options.

Select the Recovery Mode from the list (use up/down arrows) and then press the Enter key.

It may not be very obvious which option is highlighted - I could barely see on my display.

You have just booted Linux to a Command Line - no desktop loaded yet!

If you don't know the main user account name, now is a good time to find out.

Type cd / then hit Enter

This will take you right back to the root of the file system.

Type ls then hit Enter (that is LS in lower case).

You'll see a list of stuff - ls is unix shortcut for list.

One of the items listed will be a folder called 'Home' - type cd home then hit Enter to jump into that folder.

(cd is unix shortcut for change directory - just like DOS)

Now type ls then hit Enter again to list the contents of the Home folder - you should see a folder with the same name as the main user - that's the main user account name!

Now type cd / then hit Enter, then type passwd <username>

(replacing <username> with the main user account name - without the <> symbols of course)

Follow the prompts to set a new password.

Reboot the computer by typing reboot and hitting Enter.

Job done!

Why so simple? I hear you ask.

Because the password is to prevent unauthorised access to the system settings by a hacker, not to keep you the innocent user away from your computer!

This method has been tried and tested, and found to work perfectly.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License