"OMG! Help!" or "How to Regain Access to Your Ubuntu Computer Once You Have Lost Your User Name and Password!"

So, have you ever lost a password? Ever forgot your user name after coming up with something pretty nifty that is so unique you could never possibly forget it? Ever bought a used computer off Craigslist with Ubuntu installed and forgot to ask the user name and password? Yeah, well rather than going through the headache of reinstalling the entire operating system and loosing all of your data, here is an easy 3 step procedure you can use for Ubuntu password recovery!

Step One. Gain root access.

This step can be used to gain root access to any computer running Ubuntu that you have physical access to.

1. Power up the computer, and watch it load the BIOS
2. When it says "grub loading..." hit the "esc" button to get into the "grub menu".
3. hit the "e" button to go into edit mode.
4. Highlight the line that begins "Ubuntu, KERNEL......." and hit "e" for edit again.
5. At the end of this line add

rw init=/bin/bash

and then press "enter".
6. Press "b" for boot.
7. You will boot into a "root shell". This means you have administrative powers in the system now. You should see something like this

root@some-computer:~$

and nothing else.

Step Two. Recover the user name.

This is pretty straight forward. All you need to do is enter in the following code and press enter.

grep x:1000 /etc/passwd | cut -d: -f1

make sure you do it exactly as you see here, it is case sensitive. This should give you the name, let's say it gave you the name bob...write it down this time.

Step Three. Reset the Password

Again, this is pretty straight forward. Just enter in

 passwd bob

and press enter. Make sure you replace "bob" with whatever you got as a response in step 2. It will ask you for a new password, and then ask you to enter it in again to confirm. Now you have reset the password for the user name you received in Step Two. Congrats, you have the user name and password. Now you can reboot, and log in as normal.

Trackback URL for this post:

http://nousessence.com/trackback/1173
Anonymous's picture

thaaaannnkkk yyooouuu!!!

you saved me...this article has saved me n my computer!!

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.

Send this page to a friend

Thank you for spreading the word!

Mollom stats

Mollom has blocked 10045 form submissions to this site in the last 1 year 35 weeks. That’s an average of 16.3 a day.