Recover a root password on Linux systems
This HowTo will guide your through successfully recovering (resetting) the root password on most Linux based systems.
Generally all Linux distributions now use GRUB bootloader, but for older systems still using LILO bootloader, we also provide a LILO method towards the bottom of this page.
Be sure to follow the method applicable to your Linux system.
GRUB bootloader method
Step 1
Turn on/reboot your system. After the BIOS post, GRUB menu will load and display a list of kernels to boot from. Press e to edit the first GRUB menu option. If you cannot see your GRUB menu options press ESC key when prompted.
GURB menu should look similar to this:
Step 2
Using the arrow keys, select the kernel line and press e key again to edit.
Step 3
Kernel boot options may differ on your system, just be sure to append init=/bin/bash to end of the line and then press ENTER.
Step 4
Now that our boot options have been changed we are ready to boot the operating system. Press b key to boot.
Step 5
After successfully booting you will be presented with a command prompt. Here we need to mount / and /proc partitions with the following two commands:
mount -o remount,rw /
mount -o remount,rw /proc
Step 6
Reset the root password by issuing the passwd command.
passwd
Step 7
Before rebooting the system, it is a good idea to run the sync command.
sync
reboot
You should now be able to login into the system with your new root password.
LILO bootloader method
Step 1
At LILO bootloader type linux single and press the ENTER key:
Boot: linux single
Step 2
When presented with the command prompt, issue the passwd command.
passwd
Step 3
Before rebooting the system, it is a good idea to run the sync command.
sync
reboot
You should now be able to login into the system with your new root password.