How to Reset Ubuntu Password

If you forgot your user password on Ubuntu, don’t panic. You can reset an Ubuntu password very easily. This post explains an easy method for changing the root password on Ubuntu. The method should also be applicable to other Linux distributions.

Have you forgotten your Ubuntu password? It happens all the time.

It’s natural to forget the password if you haven’t used Ubuntu in a long time. The good news is that you won’t have to reinstall your operating system as a result of it. Ubuntu passwords are simple to retrieve.

The approach described here can be used to reset an Ubuntu password in VMware, dual boot, or single install environments. All you need is a little patience and the ability to run a few commands. You’ll be able to reset the root password in a matter of minutes.

How to Reset Ubuntu password from recovery mode

Step 1: Boot into recovery mode

Turn on the computer. Go to the grub menu. Generally, it appears automatically – if not, then hold down the shift key or press Esc key till the boot menu shows.

Hold down the shift key when the Oracle or VMware logo displays if you’re using Oracle VirtualBox or VMware.

Select “Advanced Options for Ubuntu” from the grub menu:

You’ll find the option to enter recovery mode here:

It will take you to a blank screen with multiple lines of output flashing over the screen. Please hold your breath for a few moments.

Step 2: Drop to root shell prompt

You’ll now be given a number of recovery alternatives. Choose “Root – Drop to root shell prompt“ from the drop-down menu. To select this option, simply press the enter key. As shown in the illustration below:

When you pick the root shell prompt option, you’ll see that a command entry option appears at the bottom. This is your root shell prompt, and it’s from here that you’ll issue the password reset commands.

Step 3: Remount the root with write access

You must be able to write to the root partition. It has read-only access by default.

To remount it with write access, use the following command:

mount -rw -o remount /

Step 4: Reset username or password

You’ll be given root access here. To see a list of all accessible users, run the following command:

ls /home

Choose the “username” for which you wish to reset or (say) hack the password based on this command. To reset the password for the selected “username,” run the following command:

passwd username

It asks you to enter a new password. Double-enter the new password:

Enter new UNIX password:
Retype new UNIX password:

Voilà! So there you have it. You’ve just completed a successful password reset. To get out of the root shell prompt, type:

exit

You’ll be taken back to the recovery mode menu when you exit. Here, choose the standard boot option.

A notice concerning graphics mode compatibility will appear. Don’t be concerned. Any problems will be resolved by a complete reboot.

With the new password, you should be able to log in.

Possible Troubleshoot:

You may be confronted with an Authentication token manipulation error while entering the new password:

passwd username
Enter new UNIX password:
Retype new UNIX password:
passwd: Authentication token manipulation error
passwd: password unchanged

The file system is mounted with read-only access, which causes this issue. Change the access permissions and remount the file system as follows:

mount -rw -o remount /

Reset the password if necessary. It should now work.

As you can see, changing your Ubuntu password, even if you’ve forgotten it, is really simple. It will just take a couple of minutes.

Alternate method to reset Ubuntu password

If you’re having trouble getting to the root shell and changing the password for some reason, try these instructions.

Step 1. Your computer should be restarted. If the grub screen does not show automatically, hold shift to bring it up. To edit the grub screen, press E at the grub prompt.

Step 2. Change the ro to rw and insert init=/bin/bash to the end of the line that starts with linux.

Step 3. To save your modifications and restart, press ctrl-x.

Instead of using a graphical user interface, you’ll utilize the bash shell now that you’ve booted inside the Linux kernel with read and write permissions.

In other words, your system will start up with a root shell that does not require a password.

Step 4. Enter your username in the passwd command. If you don’t know the username, use the ls /home command to find out (as mentioned in method 1).

Create a new password.

Exit the terminal once you’ve set the new password. Simply type reboot or use the shutdown command on the terminal.

shutdown -r now

You should change your password right now.

If resetting Ubuntu passwords is this easy, isn’t this a security risk?

That is an excellent question. Security is one of the key advantages of Linux over Windows. But how can Ubuntu or other Linux distributions be deemed secure if “anyone” may reset the password?

Allow me to explain a few points. The major security danger is if someone hacks into your account via the internet from a faraway place. That is not the case here.

The data on your computer is already at risk if someone has physical access to it. Anyone can “steal” your data via a live USB without even visiting your installed operating system unless the entire disk is encrypted.

Ubuntu doesn’t have a root password by default, and the root account is locked. The user account you created during the installation of Ubuntu is set up as an administrator with sudo access. However, this does not imply that you are a root.

The lack of a root password is a design choice. From the “root shell prompt,” you can execute some special root-related actions using the “advanced options for Ubuntu” in the boot menu. This is why you can use this method to reset the Ubuntu password.

You may either encrypt the disk (to keep your data) or establish a password for the root user in Ubuntu to make your system more secure.

Bonus Tip: Handling the possible keyring issue after changing password

In Ubuntu, there is a keyring function that is used to keep passwords safe and secure.

The keyring remains unlocked after you reset the forgotten password, and you may receive an error message similar to this.

Delete the Login passwords from the Passwords and Keys program.

When you open Google Chrome on Ubuntu again, it will prompt you to generate a new keychain. As the keyring password, use the new login password.

Did it help you?

I hope that my explanation of how to reset forgotten passwords in Ubuntu was clear.

In this video, we are gonna show you how to reset your forgotten password in Ubuntu 20.04:

Have you been able to recover your admin password using this fast tip? Please share your thoughts in the comments section below.

 
Loading Facebook Comments ...