The fastest way: use your recovery key or another admin account
If you set up Ubuntu with a recovery key (a long string of characters Ubuntu showed you during installation), you can use that to reset your password without restarting into recovery mode. Open a terminal, type ubuntu-report, and follow the prompts — this works on Ubuntu 20.04 and later if you saved that key.
If you have another user account on the same machine with admin rights, that person can reset your password from their account. They open Settings, go to Users, select your account, and click the password field to change it. This is the simplest route if someone else uses the machine.
If neither of those applies — you have no recovery key and you are the only admin — you will need to restart into recovery mode and reset the password from there. This takes about five minutes and requires no special tools.
Key Takeaways
- If you saved your recovery key during Ubuntu installation, you can reset your password without restarting by opening a terminal and running ubuntu-report.
- Another admin user on the same machine can reset your password through Settings without you needing to do anything.
- If you have neither a recovery key nor another admin account, restart into recovery mode by holding Shift during boot, select "root" from the menu, and use the passwd command.
- After resetting your password in recovery mode, type reboot to restart normally and log in with your new password.
- If you cannot access recovery mode or the password reset fails, you may need to boot from a Ubuntu USB drive to reset the password from outside the system.
Resetting your password in recovery mode
Restart your computer and hold down the Shift key as it boots. You should see a menu with boot options. Select "Advanced options for Ubuntu" and then look for an entry that says "Recovery mode" — it usually appears as something like "Ubuntu (recovery mode)". Press Enter.
The system will load into a minimal environment and show you a menu with several options. Look for "root" or "Drop to root shell prompt" and select it. You will now be at a command prompt with root privileges, which means you can change any user's password.
Type passwd username, replacing "username" with your actual Ubuntu username. The system will ask you to enter a new password twice. You do not need to type your old password — root can change it without knowing it. After you type the new password twice, you will see a message saying the password has been updated.
Type reboot to restart the computer normally. When it boots back up, log in with your username and your new password.
What to do if Shift does not show the recovery menu
On some machines, holding Shift during boot does not work. Try holding Escape instead, or try pressing and releasing Shift repeatedly as soon as you see the first sign of boot activity. On some systems, you may need to press Delete, F2, or F12 to enter the boot menu — the key varies by manufacturer.
If none of those work, you can boot from a Ubuntu USB drive instead. You will need another computer to create the USB drive using a tool like Balena Etcher or Rufus, and you will need a USB drive with at least 4 GB of space. Insert the USB drive, restart your computer, and press the key that enters the boot menu (often F12 or Escape). Select the USB drive from the list and press Enter.
Once Ubuntu loads from the USB, select "Try Ubuntu" instead of installing. Open a terminal and type sudo mount /dev/sdaX /mnt, replacing "sdaX" with your actual partition — you can find it by typing sudo fdisk -l first. Then type sudo chroot /mnt followed by passwd username to reset the password the same way as recovery mode.
Preventing this from happening again
Ubuntu shows you a recovery key during installation — a long string of random characters. Write this down or save it in a password manager when ready. If you lose access to your account, this key can reset your password without needing recovery mode or a USB drive.
You can also create a password reset disk, though this is less common on modern Ubuntu systems. Go to Settings, select Users, click your account, and look for an option to create a password reset disk if your version offers it.
If you are the only user on the machine, consider setting up a second admin account for a trusted person, or at minimum write down your password in a find location (a safe, a locked drawer, or a password manager) so you have a backup if you forget it.
Troubleshooting: password reset did not work
If you typed the passwd command but got an error message, make sure you typed the username correctly — Ubuntu usernames are case-sensitive and do not include spaces. Type cat /etc/passwd to see a list of all user accounts on the system and find the exact spelling.
If the system says "Authentication token manipulation error", your home directory may be encrypted. You will need to use the recovery key method or boot from USB and manually decrypt the partition — this is more complex and may require help from Ubuntu documentation or forums specific to your encryption setup.
If you are stuck at the recovery mode menu and cannot find a "root" option, look for "Enable networking" first, then try "Drop to root shell prompt" or similar. Some Ubuntu versions label this differently depending on your release.
Using the recovery key if you have it
If you saved your recovery key during installation, you can use it to reset your password without restarting. Open a terminal by pressing Ctrl+Alt+T, then type sudo ubuntu-report -f send or ubuntu-report depending on your Ubuntu version. The system will ask for your recovery key.
Paste or type your recovery key exactly as you saved it — spaces and hyphens matter. If the key is correct, the system will let you reset your password from the terminal without needing recovery mode.
If you cannot remember where you saved the key, check your email (Ubuntu may have sent it to you), your password manager, or any notes you took during installation. If you genuinely cannot find it, recovery mode is your next option.
Frequently Asked Questions
Do I need a USB drive to reset my password?
No, not unless recovery mode does not work on your machine. Most Ubuntu systems let you hold Shift during boot to reach recovery mode, which is faster and does not require any extra hardware. A USB drive is a backup option if Shift does not work.
Will resetting my password delete my files?
No. Resetting your password only changes the password itself — all your files, documents, and settings stay exactly where they are. You will be able to access everything once you log in with the new password.
What if I do not remember my username?
In recovery mode, type cat /etc/passwd to see a list of all user accounts. Your username is the first part of each line, before the colon. Pick the one that is not "root" or a system account (system accounts usually have names like "daemon" or "www-data").
Can I reset the password for the root account itself?
Yes, but you need to be in recovery mode or booted from USB. Type passwd root instead of passwd username. However, most Ubuntu users do not use the root account directly — if you are locked out of your regular account, resetting that account is usually what you need.
What if recovery mode asks for a password before letting me in?
Some Ubuntu systems are set up to require a password even in recovery mode. If you do not know that password, boot from a USB drive instead — the USB method does not require any password to reset your account password.