The Root user is the super user who is responsible for all the configuration .He is also responsible for the major changes done to a linux distribution. He by default has access to all commands and files on a linux or other Unix like operating system. But sometimes there is a situation when system administrators or system engineers forgets or lose their root password. Now that’s a little hectic situation. To overcome this situation we have to reset the root password.
In this tutorial I will guide you through all the steps to get your ‘Root access’ again in ubuntu 21.04.
STEP(1) Reach out to the GRUB2 Bootloader
First of all reboot your system to reach out to GRUB2 Bootloader. Navigate to the ubuntu option of the boat loader and press “e” for edit.
STEP(2) Boot option modification
Find the line starting with “linux”. Now add the following at the end of the line:
init=/bin/bash
STEP(3) Boot the System
Now after adding that , press Ctrl + x or F10 instruct your system to boot. After a clean boot you will be provided with a command line.
STEP(4) Reset your Root password
When you get the command line after the boot, enter the following to reset your Root password:
# mount -o remount,rw /
# passwd
This command simply remounts root partition in read write mode so that you can persist any changes to the disk .
Congrats , your Root password has been updated successfully.
STEP(5) Login to the system
Now its the time to login your system as a Root user.
Conclusion
In this tutorial , I had guided you through all the steps to reset your Root password in your ubuntu 21.04 system. I Hope this tutorial helped you to get out from a stuck situation and gain Root access to your system again. You can also follow my other articles.
This is actually a Linux security hole.