Lost linux password

From WikiTechia

Jump to: navigation, search

Lost linux password(s) can be retrieved a couple of ways. You will need a linux live disc handy.

Solution

Shadow file

The shadow file is what most linux systems will use to store passwords in an encrypted format. It's almost always stored at

/etc/shadow

A typical entry might look like

joeblow:$2$EJh/yBEg$i7zLmJKHp0T2Io//v442m/:13074:0:99999:7:::

The second field is the encrypted password.

Modifying the shadow file

Using a live cd, the partition that the shadow file is located can be mounted. The shadow file can then be edited the file using a text editor. The best solution for modifying the field is to copy the field of a known password from another user.

To get a known password, one might want to use the command "passwd" in the live environment and copy the line (usually root) from the live environment's shadow file.

Personal tools