Forgotten or Lost Linux Root Password
It’s inevitable that at one time, or another, a Linux sys admin will forget or lose a root password for a system they manage or that they’ll inherit a server to which the root passwords are unavailable for.
Thankfully, a Linux servers root password can be reset in a few simple steps via single-user mode.
To enter single-user mode, reboot your computer. If you use the default boot loader, GRUB, you can enter single user mode by performing the following:
- At the boot loader menu, use the arrow keys to highlight the installation you want to edit and type [A] to enter into append mode.
- You are presented with a prompt that looks similar to the following:
grub append> ro root=LABEL=/ - Press the Spacebar once to add a blank space, then add the word single to tell GRUB to boot into single-user Linux mode. The result should look like the following: ro root=LABEL=/ single
- Press [Enter] and GRUB will boot single-user Linux mode. After it finishes loading, you will be presented with a shell prompt similar to the following: sh-2.05b#
- You can now change the root password by typing:
passwd root
- You will be asked to re-type the password for verification. Once you are finished, the password will be changed.
You can then reboot by typing reboot at the prompt; then you can log in to root as you normally would.
Comments are closed.