How to Reset a Lost Administrative Password on Ubuntu?

In Linux, the super user or the root user is also known as the administrator because it has all the administrative privileges. It contains a strong password for security purposes, and without it, no task can be performed in the system. It requires authentication in the form of a root user password before performing operations like installing, removing, updating, upgrading, and many other tasks.

If the root user forgets its password, then it can be easily reset by using the root user shell prompt. This guide enlists the complete procedure to reset a lost administrative password on Ubuntu.

How do I Reset a Lost Administrative Password on Ubuntu?

Follow the step-by-step instructions to reset the lost administrative password on Ubuntu.

Step 1: Switch to Recovery Mode

First, restart the ubuntu system. Open the “GRUB” menu by pressing the “Shift+Esc” key from the keyboard. The black and white GNU GRUB menu will open. 

Use the “down-arrow” key from the keyboard to select the “Advanced options for Ubuntu”:

Hit the “Enter” key and then select the “recovery mode” option as shown in the image:

It will bring you back to the black-and-white prompt. Wait here for a few seconds.

Step 2: Navigate to Root Shell

The “Recovery Menu” is open and contains an option list. Navigate to the “root” option from the “Recovery Menu” and open the root shell:

The “root shell prompt” is opened below the “Recovery Menu,” where we will execute the command to reset the administrative password:

Step 3: Remount the Root(File System) Via Write Permissions

The file system has only “read-only” permissions, which means that no changes can be written to it. So remount the current file system with the right permissions using the below-mentioned command:

# mount -rw -o remount /

Now, the user should make changes in the system.

Step 4: Reset the Administrative Password

Type the “passwd” command with the administrative name or desired user name in the following way:

# passwd itslinuxfoss

Enter the new password for administrator “itslinuxfoss” and hit the “Enter” key. Re-type the password again for verification:

The output displays a new password set for the “itslinuxfoss” administrator.

Conclusion

On Ubuntu, reset the lost administrative password using the “root shell prompt” with the “passwd” command. This shell is opened through the “recovery mode” from the “GNU GRUB” black and white screen. This guide has demonstrated all the necessary steps to reset the lost administrative password on Ubuntu.