Ubuntu Forgot Password
A sudo user would be created for performing every sort of administrative operation when installing the Ubuntu system for the very first time. We can easily change the forgotten password of the administrative user or sudo user from the accounts of other sudo users if we have multiple sudo users. What if we have just a single sudo user and we forgot the password? It's very easy to reset the forgotten password of sudo users in Ubuntu systems.
In a Linux-based systems platform, the root account is initial in the hierarchy of user roles. The root user includes the most power in the Linux System. All users require the permission of the root user to make modifications to these systems. The root user is authorized for changing and overriding the permissions of any other user by virtue of his limited rights.
The default account of the root user is disabled initially, but users can make relevant modifications if they know the root password of the system in the case of the Ubuntu system. The actual issue appears when users forget the password of the root user in their computer.
In this article, we will explain how we can reset the password of the root user in the 20.04 system of Ubuntu by booting the Ubuntu system into the mode of rescue and changing the Grub bootloader configuration.
Changing the Password of the Root
We need to open the terminal window by pressing the Ctrl+Alt+T shortcut keys. Also, we can access the terminal by jumping on the Applications Terminal of our system. We need to enter the following command in our terminal window for changing the root password:
Then, the system will ask the users to type the new password that they wish to set up. Again, the system will ask the user to enter the new password one more time within the Retype new password section when we click the Enter button.
Then, the password will be successfully updated when we will click the Enter button using our keyboard.
Resetting the Password of the Root
Users need to type the password of the user when they have forgotten the root password.
1. Booting to Recovery
Users require to reboot their system to start with this method. Click on the shift key using our keyboard as soon as the splash screen occurs. GNU GRAB screen will occur as shown below:
For Ubuntu, it is the boot menu that has distinct kernel releases that are shown and have distinct options. Choose the option Ubuntu by clicking the enter button. We need to click on the 'e' key for opening up the grub parameters which are to be changed when we selected Ubuntu.
2. Editing the Configurations
After that, we need to again use the arrow keys and then scroll down to the last line that starts with the keyword, i.e., 'linux /boot/vmlinuz'.
We need to substitute the "ro quiet splash $vt_handoff" term with the "rw init=/bin/bash" term.
3. Restarting the system
In this step, we need to restart our system. It can be done by using the F10 or Ctrl+X shortcut keys. It will help us to restart the system with the updates we made in our system. The system will reboot and then we will be jumped to the root shell of our system. The shell will occur just one time and it will normally appear in the future.
We require to append the below command within the shell to check that if the file system of our root has been correctly mounted.
4. Editing the Root Password
We need to enter the following command in the terminal to edit the root password:
Then, the system will ask us to enter a new password and when we have clicked the enter button, it will again prompt us for retyping the new password. A success message will occur on the screen when the password is successfully updated.
Now, the password is edited successfully. We can reboot our system for confirming the updates.