User roles on a Linux operating system are hierarchy-based. The root user sits on the iron throne and is able to control the actions of all other users. It is the administrative/authentication power of this root user that controls the actions of any other user with access to the Linux system.
[ You might also like: How to Create a Sudo User in Ubuntu Linux ]
The root user can override or change normal users’ actions and permissions. Therefore, things like system updates, app installation & configuration, and general system configuration might sometimes require the approval of the root user password.
So what happens when a normal Linux user or system administrator forgets the system’s root password? Please note that changing the root password is different from resetting the root password.
During such incidences, you might think you have reached rock bottom and even think about re-installing your Ubuntu system. However, this article guide is here to prescribe the ultimate pain killer for this headache.
Reset Forgotten Root Password in Ubuntu
The solution to this problem entails restarting your Ubuntu system, accessing the Grub boot loader menu, and booting into the Ubuntu system from the recovery mode.
Therefore, restart your Ubuntu-powered machine, and once the computer’s screen dims, continuously press the keyboard’s
[Shift] keys until you are redirected to a Grub menu screen.
From the provided GNU Grub Menu screen capture, you will see a number of menu options. Use the keyboard’s
[down] arrow keys to navigate to the Advanced Options for Ubuntu segment.
[Enter] on your keyboard and you will be redirected to another Grub window and here choose the menu option that will direct you to Ubuntu (recovery mode).
Wait a few seconds for the dashing black screen to complete its execution. Another display screen with several menu options will appear.
Navigate to the menu option root Drop to root shell prompt and hit
[Enter] on your keyboard.
At the bottom of this display window, you will be presented with a command-line interface with direct access to the root shell prompt.
The next step is to remount the root filesystem partition
(/) with write access. Its default access partition is read-only.
# mount -rw -o remount /
From here, you can now comfortably reset the root password and even username if you wish. Before you can reset the root password, you need to be able to identify the user associated with it.
# ls /home
After you identify the root user, use the following command syntax to reset the associated root password:
# passwd username
We can now change the root password by referencing the above syntax.
You will be prompted twice to enter and re-confirm the new root password you wish to use.
From here, you will have achieved the ultimate hack into resetting the root user password on your Ubuntu system.
Key in exit on the console and hit
[Enter] on your keyboard. You will again find yourself on the Recovery Menu window. Choose the menu option to Resume normal boot.
Ignore any graphics mode compatibility warning as a complete system reboot will fix it.
Based on the root password you set, you should be able to comfortably re-enter your Ubuntu system as an admin/root user.
With this article guide, you do not have to worry about losing control of your root privileges on an Ubuntu system as you can easily regain it from the article’s simplified step-by-step instructions.