How to reset Ubuntu’s forgotten password

If you’ve ever lost your password, you’re not the only one. It’s definitely one of the most popular issues with tech support that people have throughout the years. The good thing is that, due to a forgotten password, you do not have to reinstall the whole operating system. In Ubuntu, they have made it extremely easy to restore your password. In VMware, single or dual boot, the methods listed here work to restore the Ubuntu password, and you’ll be able to restore your login credentials within minutes.

Let’s start by demonstrating Ubuntu Password Reset from Recovery Mode.

Booting into Ubuntu recovery mode:

Turn on your computer system and go to the grub menu. Mostly it appears immediately, but if that doesn’t happen, press escape or hold the shift key down until it appears. While working on VM-ware or VirtualBox, when the Oracle or VM-ware logo appears, you have to press the shift key. GRUB menu will be prompted to your screen, here select “Advance Options for Ubuntu“.

Now an option will be displayed, select it to go to the recovery mode:

You will see a black screen with a flash showing multiple lines of data. Here, wait for some time.

Root shell prompt:

You will be provided with numerous recovery mode options here. Select the one named “Root – Drop to Root Shell Prompt” from the given options. Press enter, and you’re all set.

You’ll see that there is an option to enter commands at the bottom when you choose the root shell prompt option. This is the prompt for your shell, and here you will be doing some magic to restore your forgotten password.

Remount root filesystem with write access:

By default, the root partition has given read-only privileges. But here you have to provide root and write access too. To remount it with write permission, use the following command:

[email protected]:~$ mount -rw -o remount /

Reset username or password:

List the available users using the following command once you will be provided with the root access :

[email protected]:~$ ls /home

Or you can see the available users by displaying the contents of /etc/passwd file using the following command:

[email protected]:~$ cat /etc/passwd

From the usernames accessible, select the one for which you’d prefer to reset the password. Now, reset the password for the chosen username by typing the following command:

[email protected]:~$ passwd  <user>

Enter new UNIX password:

It will ask you for a new password. Type the new password once and then again to confirm it:

[email protected]:~$ Retype new UNIX password:

You have restored your password successfully. Enter the Exit command for exiting the root shell.

On entering exit command, we will prompt back to the Recover Boot menu. Now, choose the standard boot option on the screen. There will be an alert about compatibility with the graphics mode. You don’t have to worry about it. A reboot will solve all these compatibility issues. Now we just have to log in with the password we just have set.

Possible Error:

    You may be encountered with Authentication token manipulation error when entering the new password:

    The cause for this error is that it is still mounted with Read-Only access. To overcome this, just type the command for remounting the file system and modify the access.

    Change the password once again. It will work now without displaying any errors.

Alternate method for resetting the password:

If you have trouble changing the password via root shell for some reason, you should follow these steps:

Step 1

Get the computer rebooted. To bring up the grub screen, hold the shift key for some time. To edit the Grub panel, click E.

Step 2

From the given set of lines, find any line starting with “Linux” using the up and down arrow keys and change access from read-only to read-write by just replacing ro recovery nomodeset to rw init=/bin/bash.

Step 3

To save the changes and to boot, press ctrl-x. You are now booting with both read and write access into a Linux kernel, here you can use the bash shell instead of GUI. In other words, a passwordless root shell will boot into your system.

Step 4

Type your username into the passwd command. If the username is unknown, search with the ‘ls /home’ or ‘cat /etc/passwd | grep -i bash’ command. Now reset the password and then exit the terminal. After it’s done, reboot using the following commands and you are good to go.

[email protected]:~$ reboot

[email protected]:~$ shutdown -r now


Ubuntu’s root account will be locked as it does not have a root password by default. A user account you set up before installing Ubuntu is included as an administrator with sudo privileges. Yet, in any capacity, it doesn’t imply that you are root. This absence of a root password is an intended feature of Ubuntu. “The boot menu for “Ubuntu Advanced Options” allows you to perform certain root-related functions from the “root shell prompt.” This is why you can reset the Ubuntu password from this method.

Question is If it’s this quick and easy to restore Ubuntu passwords, isn’t this a security risk? The major security threat is if someone breaks into your account from a different location through the internet. It’s not occurring here. In case that some malicious entity has physical access to your computer system, its security is already at extreme risk. Well, if you want not to have this feature, you can disable it by encrypting your Hard Drive via LUKS encryption while installing Ubuntu.

About the author

Sidratul Muntaha

Sidratul Muntaha

Student of CSE. I love Linux and playing with tech and gadgets. I use both Ubuntu and Linux Mint.