Have you ever forgotten your login password in Ubuntu or any Linux distribution and found yourself stuck? Don’t worry, in this post, I will show you how to reset a forgotten Ubuntu login password in just a few minutes.
First, note down your username and restart your PC (In my case its “tester“).
Your PC should boot into the grub menu. Use the arrow keys to interrupt the grub timeout limiter and choose “Advanced” to boot Ubuntu into recovery mode.
You will see the recovery menu, which will indicate that the file system is read-only. Using the arrow keys, scroll through the root user and press the enter key to open the root shell, also known as the super admin user, who can modify anything.
By default, Ubuntu systems give direct access to the root shell if you haven’t set any root password.
Once you are inside the root shell, type the below command to change the file system from read-only to read and write.
mount -o remount, rw /
Then type “passwd” and the username you want to reset the Ubuntu password for (e.g., tester) and press the enter key. You may see a new password prompt, so go ahead and set the new password.
Once it’s done, type “exit” and resume into Ubuntu using the recovery mode.
Now, log in with your new password. It’s as simple as that!
Note: One thing to remember is that after booting into Ubuntu from recovery mode, the GPU drivers will be disabled, so to fix that, restart your PC to load the installed GPU drivers.
If this method doesn’t work for you, there is another way to reset the forgotten Linux password. Restart your computer and interrupt the grub timer by using the arrow keys.
Highlight the first option and press the letter “E” on your keyboard. Look for the line called “linux” and change “RO” to “RW“. Then, add the below argument to the end of the line.
Press F10 or Ctrl+X to save the changes, and your system should boot into the single-user mode or root shell. Type “passwd” and the username you want to reset the password for (e.g., hp), then press enter. You may see a new password prompt, so go ahead and set the new password.
Once it’s done, shut down the PC by holding the power button. Press the power button again to boot into the Linux system and enter the new password to log in.
This is another way of resetting the forgotten login password on Linux systems, and it will work on any Linux distribution. Now you know how to reset a forgotten Ubuntu login password quickly and easily.