Password can be reset in the Ubuntu
very easily using the recovery mode. I have seen many people who are
rebooting or reinstalling the entire system after they forgot their
Ubuntu password. You don’t have to reinstall your entire system just
because you forgot your password. There are various ways to reset the
password. I am going to show you the easiest and quickest way. Do not
feel scare in the process as you have to face the black screen. It’s
the safest way and is not harmful at all. You can quickly reset the
password without any harm following these simple steps. I would like to
apology for bad screenshot which is taken by my phone camera.
Step 1: After you start your system, choose the recovery mode and hit Enter.

Step 2: Now after you go to the recovery mode, it will take certain
time to load all the hardwares. After sometime, this following screen
will appear.

Step 3: Now, the real password resetting process starts from here. Type:
sudo username
Step 4: I am going to reset my password, the username is sachit. The
thing is you need to at least know the username. Type the new desired
password.

Now, the password is successfully updated.
Step 5: You need to reboot the system now. Type these following commands:
sync
reboot -f

The password reset process is successful. Login with your new password and enjoy.
After logging in the screen “Enter password to unlock your login
keyring” might appear. To make it disappear you need to type your old
password which you don’t remember. So, change your password again by
following the same process. In the next startup type your keyring
password which you set at the first reset process.