Quantcast

Archive for category linux

Recover root password under linux with single user mode

1. Enter runlevel 1

Some Linux distribution, such as Ubuntu for instance, offer a specific boot menu entry where it is stated “Recovery Mode” or “Single-User Mode”. If this is your case, selecting this menu entry will boot your machine into single user mode, you can carry on with the next part. If not, you might want to read this part.

Using GRUB, you can manually edit the proposed menu entry at boot time. To do so, when GRUB is presenting the menu list (you might need to press ESC first), follow those instructions:

* 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#).

2. Changing root password

As root, changing password does not ask for your old password, therefore running this 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