In this article, I will show you how to reset the root password on Ubuntu. User roles on the Linux operating system are based on a hierarchy. The root user sits on the throne and can control the actions of all other users. It’s the admin/authentication rights of the root user, which controls the actions of any other user that has access to the Linux system.
Join the channel Telegram of the AnonyViet 👉 Link 👈 |
The root user can override or change normal user actions and permissions. As a result, things like system updates, application installation and configuration, and general system configuration may 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? Note that changing the root password is different from resetting the root password.
How to reset root password when forgotten in Ubuntu
The solution to this problem requires restarting your Ubuntu system, go to Grub boot loader and boot into the system Ubuntu from recovery mode.
Therefore, restart your Ubuntu and after the computer screen goes dim, keep pressing the keys [Esc] or [Shift] of the keyboard until you are redirected to the Grub menu screen.
Use arrow keys [lên] and [xuống] of the keyboard to enter Advanced Options for Ubuntu.
Press [Enter] and you will be redirected to another Grub window and select recovery mode.
Wait a moment, the screen below appears.
Select root Drop to root shell prompt and press [Enter] on your keyboard.
At the bottom of the window, you will see a command line interface with direct access to the terminal root shell.
The next step is to re-grant the root (/) filesystem partition with write permissions. Its default access partition is read-only.
# mount -rw -o remount /
Next you are free to reset the root password and even the username if you want. Before resetting the root password, you need to identify the user associated with that password.
# ls /home
After you have identified the root user, use the following command syntax to reset the root password:
# passwd username
You will be prompted twice to enter and reconfirm the new root password you want to use.
Type escape key on terminal and press [Enter] on your keyboard. You will return to the Recovery Menu window. Select Resume normal boot.
Ignore any graphics mode compatibility warnings as a complete system reboot should fix the error.
Based on the root password you have set, you should be free to access your Ubuntu system again as the admin/root user.
So you don’t have to worry about losing control of your root privileges on your Ubuntu system.