Wednesday, May 5, 2010

Lost Linux Root Password?

One of the easiest ways is by making blank password. If you still can boot into Linux system follow these steps. Otherwise you will need to boot from Live CD or Live USB to edit shadow text file. If you can find a original Live CD download small ~100Mb distro called PuppyLinux and burn to CD.

  1. You need to open some text editor as root. Open terminal and type sudo vi.
  2. Open etc/shadow and look for your username.
  3. The mix of letters and symbols is your encoded password. Delete all those symbols until : sign. Save the file. You can read more about how to edit the "shadow" file here.
  4. Now open terminal again and type passwd to change the password. You will be prompted to enter password twice.
If you can't find a encrypted password in shadow file try to open the passwd. Instead of * there will be your password from symbols and letters. You should read more info about "passwd" file here.

Note: always make a backup before editing those files.

No comments: