In this article, you will learn how to reset your Ubuntu password if you have forgotten it. The guide work on various Ubuntu versions such as Ubuntu 18.04, 20.04, 21.04, and the newer versions.
There are times when you forget the password for your Ubuntu system, maybe not you, it could be your family member, friend, or colleague. Not just password, people sometimes also forget the username of their system. In any of these cases, you have to show off your Linux skills and resolve the issue. So in this guide, you will basically learn all the steps to reset the Ubuntu password and also identify the username.
So let’s start.
Resetting Ubuntu password
In order to reset the password, you first need to boot into the recovery root shell, for this simply reboot and select Advanced Options in the GRUB menu.
When you are inside the recovery root shell, execute these commands:
First, you need to mount with read/write permissions.
mount -rw -o remount /
After mounting with read/write permissions, you can check the available users in the system. There are different ways to do that, the easiest one is to simply list the home directory and see how many users’ directories are there and identify your username from that.
For this simply execute the listing command.
Now that you have identified your username, it’s time to reset the password for it. In my case the username is linuxh2o so I will reset the password for it.
Now the shell will ask you to end the new password twice, simply provide the new password and reboot the system.
The system will normally reboot into the graphical interface, just log in with the new password.
All done! You have successfully reset your Ubuntu password.