Forgetting passwords can be an absolute nightmare, and if you’ve had the misfortune of forgetting the password to your PC, 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.
Reset Ubuntu Password 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 not to remember Ubuntu’s password if you’re not a regular user.
To reset the forgotten password, we will boot Ubuntu 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.
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.
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:
Once your new password has been updated successfully, reboot your machine and log in to access your account.
Recover a Forgotten Ubuntu Password
You can easily reset a lost Ubuntu password through the recovery menu in just a few minutes.
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.