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
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
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
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.