How To Reset Your Root Password Using Grub Single User Mode

Today I was confronted by someone who lost their root password, lucky for them they were using grub as their bootloader and it wasn’t password protected. This is the default for Ubuntu, Fedora, and other distros

There are X steps to this process:

Step 1. Get into the Grub Editor
When you boot you’ll probably see a few options in your grub menu. Unless you’re sure what kernel that you want to use, select the kernel at the top of the list and press e.

Step 1.1 Get into the Grub Editor (Part 2)
Hit the down arrow until the line that starts with kernel is selected, then press e again

Step 2. Enable Single User Mode
All that you have to do in order to enable single user mode is add the word “single” to the end of the line. Hit enter to return to the previous screen.

Step 3. Boot into your Single User Environment
With the same kernel selected press b to boot into the your new os.

Now you should be in a nice shiny root prompt. Feel free to do whatever you want here, including typing passwd to change the root passwd.

2 thoughts on “How To Reset Your Root Password Using Grub Single User Mode

  1. The problem is when I do what U say, even then, I get something like this:
    “Give root password( for maintance)
    or press CTRL+D to continue.”
    what do I wrong? should be the selected partition changed from “ro” to “rw” before typing “single” and should here be line “save defaults”????
    Thanks for all hints.

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright ยฉ 2024