Brief: If you forgot the user password in Ubuntu, don’t worry. You can reset Ubuntu password very easily. This guide shows an easy method to change the root password in Ubuntu. The method should also be applicable to other Linux distributions.
Forgot the Ubuntu login password? It Happens.
If you don’t use Ubuntu for some time, it is only natural to not remember the password. Good news is that you don’t need to reinstall the entire operating system because of it. You can recover Ubuntu password easily.
The method mentioned here work for resetting Ubuntu password in VMware, dual boot or single install. All you need is a little bit of patience and run a couple of commands. You’ll reset the root password within minutes.
Reset Ubuntu password from the recovery mode
If you prefer watching videos over reading text, I have also made a video of this tutorial. Don’t forget to subscribe to our YouTube channel for more Linux tutorial videos.
Step 1: Boot into the recovery mode
Switch the computer on. Go to Grub menu. Generally, it appears automatically, if not then hold down the shift key until the boot menu appears.
If you are using Oracle VirtualBox or VMWare, you have to hold down the shift key when the logo of Oracle or VMWare appears.
In the grub menu, select the “Advanced Options for Ubuntu”:
In here, you’ll see the option to go to the recovery mode:
It will bring you a black screen with several lines of output being displayed in a flash. Wait for few seconds here.
Step 2: Drop to root shell prompt
Now you will be present with different options of recovery mode. Here you need to choose “Root Drop into root shell prompt“. Just press enter key to select this option. Like in the picture below:
You’ll see that when you select the root shell prompt option, an option to enter commands appear in the bottom. This is your root shell prompt and this is where you’ll use the commands to reset the password.
Step 3: Remount the root with write access
You need to have write access to the root partition. By default, it has only read-only access.
Use the command below to remount it with write access:
mount -rw -o remount /
Step 4: Reset username or password
Here, you will be presented with root access. Use the following command to list all the users available:
From the previous command choose the “username” for which you want to reset or (say) hack the password. Now, use the following command to reset the password for the selected “username“:
It prompts for a new password. Enter the new password twice:
Enter new UNIX password:
Retype new UNIX password:
Voilà! There you go. You have just successfully reset the password. Now exit the root shell prompt:
When you exit, you’ll be back to the recovery mode menu. Select normal boot option here.
There will be a warning about graphics mode compatibility. Don’t worry. A complete reboot will fix the issue if there is any.
You should be able to log in with the new password.
While entering the new password you might be prompt with Authentication manipulation error like this:
passwd username Enter new UNIX password: Retype new UNIX password: passwd: Authentication token manipulation error passwd: password unchanged
The reason for this error is that file system is mounted with read access only. Change the access and remount the file system in the following manner:
mount -rw -o remount /
Now try to reset the password again. It should work now.
As you can see, it is extremely easy to change Ubuntu password even if you forgot the login. It will hardly take a few minutes.
Did this quick tip help you to recover your admin password? Do share in the comments below.