How to Reset Forgotten Root Password on Ubuntu

Help! I’ve forgotten the root password! Even if you’ve forgotten the root password to your Ubuntu Linux system, it’s pretty easy to recover access to the root account by setting a new password. In this guide, we’ll show you how to set a new password for your root account in a few short steps.

Reset Forgotten root Password on Ubuntu

1. First, the machine needs to be off. When you boot it up, hold down your Shift key so the GRUB bootloader menu appears. Make sure the “Ubuntu” option is highlighted, then press e for edit.

Select Ubuntu option and press e for edit

2. Using your arrow keys, scroll down until you find a line that begins with linux. At the end of this line, you should see text that says ro quiet splash $vt_handoff.

Locate the line that begins with Linux

3. Delete the aforementioned text, and replace it with rw init=/bin/bash. This tells the system to give us read and write permissions, along with starting a Bash shell.

Add read-write permissions and a Bash shell to the end of the line

4. After you’ve made that change, press F10, to save it.

5. Load your usual Ubuntu kernel by just pressing Enter.

Select Ubuntu Linux kernel to load

6. You can now use the passwd command to set a new password for root.

Changing the root password with passwd command

7. Once you’re done, execute the following command to reboot your system. Then, you’ll load into Ubuntu like normal and can use the new password to access root. Subsequent boot ups should also be totally normal.

# exec /sbin/init

That’s all there is to it. You’ve successfully restored root access on your Ubuntu system under a newly configured password.

Leave a Comment

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