Ubuntu 20.04 LTS, codenamed “Focal Fossa”, results from months of efforts from the operating system and has a bunch of new features that amaze its users. You can experience substantial improvements, from boot speed to app appearance to bundled software. However, as with every operating system, some problems remain, such as forgetting the user passwords. In case you have forgotten your Ubuntu password, you can recover it in a handful of ways. However, the guide below will only go over the prime methods to help you out of the shambles.
It’s normal to forget passwords if you haven’t used Ubuntu in a while. The good news is that you won’t have to reinstall the complete operating system because of it. It’s simple to recover Ubuntu passwords using the command-line interface. This technique of password recovery may appear complicated, but it’s actually relatively easy. It applies for resetting an Ubuntu password in VMware, dual booting, or a single installation. All you need is a bit of time and a few commands to complete the task. Within minutes, you’ll be able to change the root password.
1. Recovering Password for Ubuntu via Recovery Mode
Boot into recovery mode through the Grub menu (you can also hold down the “Shift” key or “ESC” key to display the Boot Menu). Now:
- Select “Advanced Options for Ubuntu” in the Grub menu.
- The option to go to Recovery Mode will appear here. You’ll need to wait here for a few seconds. Next, a screen will appear with different recovery mode options.
- Select, “Root – Drop to root shell prompt.” Press the Enter key to select this option. (An option to enter commands will appear at the bottom as soon as you select the root shell prompt option.)
- Now remount the root with write access using the “mount -rw -o remount /” command since the root has read-only access by default.
- Use the “ls /home” command to list all the users.
- Now, choose the “username” you wish to change or reset the password for.
- To alter the password, type the command “passwd username” (When you type your new password, it won’t be displayed on the terminal screen due to the Linux security feature).
- The screen will show “Enter new UNIX password:” where you need to type the new password.
- Next, the screen displays, “Retype new UNIX password:” Re-type your new password here.
- Type “exit” to exit the root shell prompt.
That’s it! You’ll see the recovery mode menu once you exit. From here, you’ll need to select the normal boot option.
Fixing the Authentication token manipulation error
In case you encounter an error while resetting the password, the screen displays the following message:
Enter new UNIX password:
Retype new UNIX password:
passwd: Authentication token manipulation error
passwd: password unchanged
The error message you’re seeing happens because the file system is mounted with only read access. Change that and remount it using the following command: “mount -rw -o remount /” Now follow the same process to reset the password.
2. Alternative Way to Access the Ubuntu Grub Menu and Recover Password
If you’re having trouble dropping to the root shell and changing your password as we showed above, follow these steps.
- Restart your computer. To bring up the Grub menu, press, and hold Shift (if it doesn’t appear automatically). To edit the grub screen, press “E” at the grub prompt.
- Find the line starting with Linux and change the “ro” to “rw” and append init=/bin/bash at the end of that line.
- Save the changes by pressing “Ctrl+x” and boot. You’ll boot into the Linux kernel with read and write permissions, rather than a graphical user interface, and instead of using the bash shell.
- Type the “passwd command” with your username, as shown in the previous method to finish reseting the password.
- Exit the Terminal by typing “exit” and type “reboot” or use the shutdown command “shutdown -r now” which will change the password.