Recover root password


How to recover the root password in Debian 6 and RHEL 6 based systems …

On a Debian based system it something like this:


Debian6-2013-04-26-22-36-21 Debian6-2013-04-26-22-36-53 Debian6-2013-04-26-22-37-12


On the boot menu (GRUB Boot loader) select the first line and hit “e”





edit the line starting with:

linux /vmlinuz …



go to the end of the line and edit it so it looks like this:

rw init=/bin/bash nomodeset



hit CTRL +X


You are in!

Now just use the passwd command to change root’s password.


If its RHEL based system it changes a little bit:

centos_tuto-1 centos_tuto-2 centos_tuto-3 centos_tuto-4 centos_tuto-5 centos_tuto-6


At the boot menu (GRUB Boot loader) type: “e”





Edit the kernel parameter line, you know the one with the “/vmlinuz” in it.



Change the ro (read-only) for rw (read-write) and add the capital letter S and hit ENTER to accept the changes.

Next hit b (boot) and wait for the system to boot.


Once you are in the system RHEL probably has SELinux running, you have to disabled it for the password change to be accepted. to check SELinux run sestatus and to change it execute “setenforece 0″


Finally you can change the password using the passwd command.

Hope you find this useful.


Jose Quinones


Comments are closed.