Forgotten my password

Asked by Andy Barber on 2007-06-28

I have installed Ubuntu on my PC but I have forgotten my password. I have tried countless combinations of what I thought the password was but I can't get in. How do I recover the password, or how do I reinstall Ubuntu & create a new password?

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Solved by:
Andy Barber
Last query:
Last reply:
Matt Thompson (chameleonator) said : #1

You can boot the live cd and mount your root partition from there. After that, sudo -i to get a root shell and chroot to the directory you just mounted. Then you can run passwd to update the username. Here's an example:

1. I make a directory and mount my partition (happens to be sda5) on it:

sudo mkdir /media/linux
sudo mount /dev/sda5 /media/linux

2. I change to a root shell then chroot to the dir:

sudo -i
chroot /media/linux

3. Inside the new root I change the password of my user:

passwd matt

You don't have to reinstall. You need to reboot into recovery mode. That will give you a single user root shell. Then you can use passwd to change your users password and when you reboot , you should be able to login as usual.

Hope that helps.


Andy Barber (acb58) said : #3

Thanks for the help. I have re-booted in recovery mode but I get "no such command" when I try 'passwrd' or 'password'

Gord Allott (gordallott) said : #4

its not passwrd or password, its passwd :) no r at all

Siegfried Gevatter (rainct) said : #5

Because it isn't written like that, read Jo-Erlend Schinstad's post more carfully, the command is called "passwd" ;)

Andy Barber (acb58) said : #6

I apologize for my dyslexic reading. I have tried "passed" three times, with three different passwords but every time I re-boot, I'm told the username/password are incorrect!

Andy Barber (acb58) said : #7


Andy Barber (acb58) said : #8

Matt Thomson, in the first reply, said I could go into recovery mode from the CD. I don't see how that is done. I can only go into recovery mode from the installed programe.

Knuth Gurkasch (sinn3r) said : #9

That is an nice tutorial.

When you get your new root password, you can login on an TTy and use

passwd username

to change the user password

What is the command you're using? "passwd" will change password for the current user, which will be root and not your own user. Use "passwd yourusername" and, of course, never forget that passwords are case sensitive. "A" is not "a".

Andy Barber (acb58) said : #11

I have change the root password loads of times via the 'recovery mode' but when Ubuntu boot's it will not accept the new password. How do I re-install Ubuntu, so that it will accept a password?

You don't want to change your root password. The root account is disabled by default in Ubuntu, and you probably don't want to enable it. You want to change password for _your_ user. If the username of which you've forgotten the password is andy, then you want to "passwd andy".

Best Andy Barber (acb58) said : #13

Thank-you, thank-you, THANK-YOU!

Ubuntu 'appears' to be running after two re-boot's. Hopefully I can ditch Windoze & all of it's system, anti virus, ad-aware & spyware updates.

Fingers crossed, I hope to delete most Microsoft dependent software in a month's time.

Is there any online Linux Scrabble software?

Many thanks for the time you took to get me working with ubuntu.

Andy Barber

Great! I'm glad to see everything worked out. Good luck on your Ubuntu adventures :)

Andy Barber (acb58) said : #15

Gosh it is so much faster then Windoze! I will recomend Ubuntu to everyone, including my boss BT plc!

Bhavani Shankar (bhavi) said : #16

But the problem is most of them are stuck with Windoze for a long time and a lack of literacy open source software... Particularly the place where i stay....:)