For this you have to following steps, –

Start GRUB on boot (press ESC while booting) –

Press e over (recovery mode) –

Press e over the line beginning with kernel –

Press Space bar and enter “init=/bin/bash” –

Press enter –

Press b –

At command prompt type: “cp /etc/passwd- /etc/passwd” –

reboot to GRUB again –

Press e over (recovery mode) –

Press e over the line beginning with kernel –

Press Space bar and enter “init=/bin/bash” –

Press enter –

Press b –

At command prompt type “mount -o remount,rw /”

Type “passwd YOURUSERNAMEHERE”

Enter new password at prompt –

reboot to normal boot.

### Then to recover /etc/shadow file, Use following command pwconf

This command will generate /etc/shadow file from /etc/passwd

Posted in: Linux.
Last Modified: October 25, 2013

Leave a reply