News:

The Latest electronic and computer Tips that work!

Main Menu

Reset a Forgotten Root Password

Started by branx86, October 22, 2015, 01:19:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

branx86

Tips & Tutorials - for Linux users & RHEL/CentOS SysAdmins
April 20, 2014
How to Reset a Forgotten Root Password
In case you forgot the root password on a Linux system, you can reset the unknown current password and change it to a new one, by booting the system into "Single User" mode.

In Single User mode (which is equivalent to "Runlevel 1") - the regular boot process is interrupted, and you quickly reach a root prompt from which changes can be made.

Booting into "Single User" mode ("Runlevel 1")

1. When the system's boot process begins (after power-on/restart) -
Press any key to interrupt the GRUB bootloader countdown.

2. If a password was configured to protect access to GRUB - press "p" to enter the password.
If no password was configured - skip this step.

3. Press "e" to edit.

4. Use the Arrow Keys to move to the kernel line.

5. Press "e" to edit the kernel line.

6. At the end of the line (which might read, for example: "rhgb quiet"), add: "<space> single".

(Btw, "<space> 1" will work as well).

7. Press "b" to save & boot with changes.

8. After a root prompt is obtained: enter the passwd command, and change the root password to a new desired one.

9. Type exit to continue the boot, and wait for the system to load as usual.