Reset a Forgotten Root Password
Last updated
Last updated
What if you forgot your root password and wished to reset it? The passwd command won’t be of any use to you then.Fret not though, for you can reset your forgotten root password through the recovery mode. Here’s how:
Restart your Linux desktop and in the GRUB bootloader menu, press the E key. That should open up the GRUB configuration file.
Navigate through the wall of text with arrow keys till you find a line starting with the word linux.
In that line, replace ro with rw, quiet with init=/bin/bash, and erase splash. Essentially telling the GRUB bootloader to mount the root partition with read and write permissions and initialize a Bash shell.
Once you have the Bash shell, use the passwd command to change the password. Only this time around the system won’t prompt you for the current root password:
Type in your new password and finalize it by hitting Enter. Once done, restart your system with the reboot command:
That’s all you need to do. Once you boot up, you should find your root password changed to the one you just typed in. Run any command with superuser privileges to check it yourself.