How to reset the root password on Ubuntu 22.04

Forgetting the system password is a normal thing nowadays. Luckily, it is possible to reset the Ubuntu 22.04 system password, in case you have forgotten it. The Linux file system of Ubuntu comprises the root password which is the basic requirement for logging into the system. Also, without specifying the password, you will not be permitted to log in. So, you must reset it and create a new password for your Ubuntu 22.04 system.

The blog is all about resetting the root password on Ubuntu 22.04.

Resetting root password on Ubuntu 22.04

To reset the system root password on Ubuntu 22.04, go through the below-given instructions.

Step 1: Open and edit GRUB menu

In the first step, reboot your Ubuntu 22.04 system to open up the GRUB menu. At the time of system reboot, hit the “Shift” key and hold it for a minute. Then GNU GRUB menu will appear on the screen. Press “e” for the purpose of editing the GRUB commands:

Step 2: Add “rw init=/bin/bash” command

In the opened GRUB menu, use the “Down” arrow key to scroll down:

Find the line that starts with “linux”:

Add the “rw init=/bin/bash” command at the end of the line as shown below:

Step 3: Access root shell

Press the “F10” key from Keyboard to boot and access the root shell. Then, execute the “grep -w /” command to check whether the user has access to read and write in the system file. Next, run the “passwd” command to change the root password:

Step 4: Reset root password

The root shell will now ask you to enter a new password. Add a new password and confirm it by retyping the password and pressing “Enter”:

Step 5: Reboot system

After setting the root password, it is required to reboot the system. To do so, write out the “exec /sbin/init” command and press “Enter”:

That was the complete procedure regarding resetting the root login password on Ubuntu 22.04.

Conclusion

On Ubuntu 22.04, for the purpose of resetting the root password, first, reboot the system, then hit and hold the “Shift” key for opening the GRUB menu. Press “e” to edit GRUB commands, locate the line that begins with “linux” and add the “rw init=/bin/bash” command at the end of it. Open a root shell and utilize the “passwd” command for resetting the root password. Lastly, reboot the system after resetting the password. This blog demonstrated the method for resetting root password on Ubuntu 22.04.