Forgetting passwords can be an absolute nightmare, and if you need to reset the password to your Ubuntu device, then you might be pretty worried. Typically, it's much easier to reset the password of an online web account (Google, Facebook, etc.) than resetting your computer's password.

If you’ve locked yourself out of your Ubuntu system, you don't need to worry about losing important data that you may not have backed up. Luckily, there is a quick fix that helps you reset your password on Ubuntu.

Ubuntu Password Reset Through Recovery Mode

Ubuntu, by default, configures the first created user account as an administrative account, and it also prompts users to set up a password to safeguard their admin account. It's very common to forget Ubuntu’s password if you’re not a regular user, so you can take a sigh of relief as it is easy to reset.

If you forgot the Ubuntu password, boot the Ubuntu device into the Recovery Mode, drop down to the root shell prompt, and set up the new password. You can think of the root account as the super administrator that can do pretty much anything with the Ubuntu installation, so be careful with the commands you enter in the terminal.

The same steps apply to those who are running Ubuntu on a virtual machine using a hypervisor like VMware or Oracle VirtualBox.

To reset a lost Ubuntu password, first, restart your system (or virtual machine). After the BIOS screen, once you see the GRUB boot menu, press the left Shift key or Esc key.

GRUB menu after BIOS

If you timed the keypress correctly, a menu should appear as pictured above. Highlight the recovery mode option using the Down arrow key and press Enter.

ubuntu recovery menu

Allow the boot-up processes to complete, and then you’ll be directed to a Recovery Menu. Using the arrow keys, highlight the option labeled root and press Enter to drop to the root shell prompt.

On the root shell prompt, first remount the storage with write permissions enabled by typing the following command:

        mount -o remount,rw /
    

Then, type the below command with your username and enter your new password to reset it:

        passwd username
    
ubuntu password reset

Once your new password has been updated successfully, reboot your machine and log in to access your account.

You can also change the login password of your Ubuntu or Linux device in the future, after logging in to your account.

Now You Know How to Reset a Forgotten Ubuntu Password

You can reset a lost Ubuntu password through the recovery menu in just a few minutes through the Ubuntu recovery menu.

Linux-based systems are generally considered very safe, but seeing how easy it is to reset a user's password, you might consider doubling down on security.