Reset Ubuntu Password

First, you have to reboot into recovery mode.

If you have a single-boot (Ubuntu is the only operating system on your computer), to get the boot menu to show, you have to hold down the Shift key or Esc key depending on the computer during bootup.

If you have a dual-boot (Ubuntu is installed next to Windows, another Linux operating system, or Mac OS X; and you choose at boot time which operating system to boot into), the boot menu should appear without the need to hold down the Shift key.

a

From the boot menu, select recovery mode, which is usually the second boot option.

a

After you select recovery mode and wait for all the boot-up processes to finish, you’ll be presented with a few options. In this case, you want the Drop to root shell prompt option so press the Down arrow to get to that option, and then press Enter to select it.

The root account is the ultimate administrator and can do anything to the Ubuntu installation (including erase it), so please be careful with what commands you enter in the root terminal.

In recent versions of Ubuntu, the file system is mounted as read-only, so you need to enter the follow command to get it to remount as read-write, which will allow you to make changes:

1
mount -o rw,remount /

If you have forgotten your username as well, type

1
ls /home

Here you can see the username, In this case, I’m going to reset the password of username as ‘Suyash’
To reset the password, type
1
passwd username

where username is the username you want to reset. In this case, I want to reset Suyash’s password, so I type
1
passwd suyash

You’ll then be prompted for a new password.

Now the password should be reset. Type

1
exit

to return to the recovery menu.
a
a

After you get back to the recovery menu, select resume normal boot, and use Ubuntu as you normally would—only this time, you actually know the password!