Forgot your Ubuntu login password? Happens.
If you haven’t used Ubuntu for some time, it’s natural not to remember the password. The good news is that you don’t need to reinstall the entire operating system because of it. You can recover Ubuntu passwords easily.
The method mentioned here works to reset an Ubuntu password on VMware, dual boot, or single install. All you need is a little patience and execute a couple of commands. It will reset the root password in a matter of minutes.
Using Linux on WSL? It’s a little different for WSL. You can follow the steps to reset Linux password in WSL here.
Reset Ubuntu Password from Recovery Mode
If you prefer watching videos to reading text, I have also made a video of this tutorial. Don’t forget to subscribe to our YouTube channel to see more Linux tutorial videos.
Step 1: Boot into recovery mode
Turn on the computer. Go to the grub menu. Generally, it appears automatically, if not, hold down the Shift key or press the Esc key until the boot menu appears.
If you are using Oracle VirtualBox or VMware, you must hold down the Shift key when the Oracle or VMware logo appears.
the grub menu, select “Advanced options for Ubuntu”:<img src="https://itsfoss.com/content/images/wordpress/2012/07/new-grub-menu-ubuntu.png"
Here you will
see the option to go to
It will take you to a black screen with several output lines displayed in an instant. Wait a few seconds here.
Step 2: Drop the root shell prompt
Now you will be presented with different options for recovery mode. Here you need to choose “Root – Drop to root shell prompt“. Just press the Enter key to select this option. As in the image below:
You will see that when you select the root shell prompt option, an option to enter commands appears at the bottom. This is your root shell prompt and this is where you will use the commands to reset the password.
Step 3: Remount the root with
You must have write access to the root partition. By default, it has read-only access.
Use the following command to remount it with write
rw -o remount /
Step 4: Reset username or password
Here, you will be given root access. Use the following command to list all available users:
Based on this 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”:passwd username
Prompts for a new password. Enter the new password twice.
Enter the new UNIX password: Retype the new UNIX password:
Voilà! Here you go. You have just successfully reset your password. Now exit the root shell prompt:
When you exit, you will return to the recovery mode menu. Select the normal boot option here.
There will be a warning about graphics mode compatibility. Do not worry. A hard reset will fix any issues with this.
You should now be able to log in with the new password.
:When entering the new password,
you may be prompted for
an authentication token manipulation error like this: passwd username Type the new UNIX password:
Retype the new UNIX password: passwd: Authentication token manipulation error passwd: Password unchanged
The reason for this error is that the file system is mounted with read access only. Change the access and remount the file system as follows:
mount -rw -o remount /
Now try resetting the password again. It should work now.
As you can see, it is extremely easy to change Ubuntu password even if you have forgotten it. It will only take a few minutes.
Alternative Method to Reset
Ubuntu Password If for some reason you have difficulty falling into the root shell and changing the password, you can try these steps
Restart your computer. Hold down the Shift key to open the grub screen (if it does not appear automatically). Press E at the grub prompt to edit the grub screen.
Find the line that starts with linux, change the ro to rw and add init=/bin/bash to the end of that line.
Press ctrl-x to save your changes and boot.
You’re now booting into the Linux kernel with read and write permissions, and instead of going to a graphical user interface, you’ll use the bash shell.
In other words, your system will boot into a root shell with no password.
Type the passwd command with your user name. If you do not know the user name, verify with the ls /home command (as mentioned in method 1).
Set your new password.
Once you have set the new password, exit the terminal. Just type restart in the terminal or use the shutdown command.
shutdown -r now
Your password should be changed now
If resetting Ubuntu passwords is that easy, isn’t this a security risk?
That’s a fair question. One of the main advantages of Linux over Windows is its security. But if “anyone” can reset the password, how come Ubuntu or other Linux distributions can be considered secure?
Let me explain a few things here. The main security risk is if someone hacks into your account from a remote location over the internet. That’s not happening here.
If someone has physical access to your computer, the data on your computer is already at risk. Unless the entire drive is encrypted, anyone can “steal” your data using a live USB without even logging into your installed operating system.
By default, Ubuntu does not have a root password and the root account is locked. The user account you configured when installing Ubuntu is included as an administrator with sudo rights. But that doesn’t mean you’re root.
This lack of root password is a deliberate feature The “advanced options for Ubuntu” in the boot menu allow you to perform some specific root-related tasks from the “root shell prompt”. That’s why you can reset Ubuntu password through this method.
If you want to make your system more secure, you can encrypt the disk (to save your data) or set a password for the root user in Ubuntu.
Bonus Tip: Handling Possible Keychain Issue After Changing Password
There is a keychain
feature in Ubuntu that is used to keep passwords locked and secure
When you reset the forgotten password, the keychain remains unlocked and you may see an error message like this.
src=”https://itsfoss.com/content/images/size/w600/wordpress/2012/07/drop-to-root-prompt-1.png” alt=”Enter the password to unlock your Ubuntu login keychain” />
Open the Passwords & Keys app and here, remove the login passwords.
“Remove Ubuntu Keychain” />Delete Ubuntu keychain
When you try to use Google Chrome again in Ubuntu, it will ask you to create a new keychain. Use the new login password as the keychain password.
Did it help you?
hope I have cleared things up about resetting forgotten passwords in Ubuntu.
Did this quick tip help you recover your admin password? Share the comments below.