Friday 10 February 2012

Recover Lost Password Linux

If you have forgotten the password for your linux account, here is how you can change the password and log-back in the system.

For this you will need to boot from Ubuntu LiveCD (or LiveUSB).
Boot from the CD and select Try Ubuntu without Installing.

1. Open the terminal: Applications -> Terminal (shortcut key: Ctrl+Alt+T).

2. Type the command: sudo fdisk -l.
When it prompts, enter your password.


3. Note which device contains the linux partition (/dev/sda3 in this case).

4. Type the command: sudo mkdir /dev/sda3 /media/sda3
(I am entering /sda3 because it is the linux partition in my case. Replace sda3 with linux partition for you)

5. sudo mount /dev/sda3 /media/sda3

6. sudo chroot /media/sda3

7. passwd <username>

Replace <username> with the username for which you want to reset the password.
(for eg. if your username is nickhalden type the command passwd nickhalden)

8. Enter the desired password and reboot the system. 
Now you should be able to login the sytem with the new password. 

No comments:

Post a Comment