Monday, May 5, 2008

Recover Linux root password from single user mode

Lost or forgot your Linux root password? recover the root password, follow the steps :

* Restart the Linux machine, while booting press (Esc)
* use the arrows to select the boot entry you want to modify.
* press e to edit the entry
* use the arrows to go to kernel line
* press e to edit this entry
* at the end of the line add the word single
* press ESC to go back to the parent menu
* press b to boot this kernel

The kernel should be booting as usual (except for the graphical splash screen you might be used to), and you will finally get a root prompt (sh#).

Here we are, we have gained root access to the filesystem, let's finally change the password.
2. Changing root password

As root, changing password does not ask for your old password, therefore running the command:

# passwd

will prompt you for your new password and will ask you to confirm it to make sure there is no typo.

That's it, you can now reboot your box and gain root access again

No comments:

Post a Comment