The fastest way: use the GRUB bootloader menu

When you forget your Ubuntu password, the quickest path back in is through GRUB, the menu that appears when your computer starts up. You interrupt the boot process, drop into a command line, and reset the password without needing to know the old one. This works on almost every Ubuntu installation and takes about five minutes.

The process differs slightly depending on whether your system uses GRUB 1 (older machines, rare now) or GRUB 2 (standard on Ubuntu 9.10 and later). Nearly all current Ubuntu systems use GRUB 2. You will know which one you have once you see the boot menu — GRUB 2 shows a black screen with white text and a list of kernel versions; GRUB 1 looks similar but older.

Key Takeaways

  • Restart your computer and hold Shift during startup to see the GRUB menu, then select a recovery mode option to reach a root command prompt.
  • At the command prompt, type passwd username (replace "username" with your actual login name) and enter a new password twice.
  • Type exit to leave the recovery environment, then select "Resume" to boot normally with your new password.
  • If you cannot remember your username, boot into recovery mode and type ls /home to see a list of user accounts on the system.
  • Some systems encrypt the home directory; resetting the password alone will not decrypt old files, though you can still log in and create new files.

Step-by-step: resetting the password in recovery mode

Restart your Ubuntu computer. As soon as it powers back on, hold down the Shift key continuously until you see the GRUB menu appear. If you miss the window, restart and try again — you have only a few seconds. The menu shows a list of kernel versions and a "recovery mode" option at the bottom.

Use the arrow keys to highlight the recovery mode line (usually labeled something like "Ubuntu GNU/Linux, with Linux [version] (recovery mode)") and press Enter. The system will boot into recovery mode, which loads a minimal environment with a menu of options. Look for an entry that says "Drop to root shell prompt" or "root" and select it. You will now see a command line that starts with root@.

Type the command passwd username, replacing "username" with your actual login name. If you do not remember your username, type ls /home first to see a list of user folders — each folder name is a username on the system. Press Enter after typing the passwd command. Ubuntu will ask you to enter a new password, then ask you to type it again to confirm. The password does not display as you type, which is normal.

Once the password is set, type exit to leave the command prompt. The recovery menu will reappear. Select "Resume" to boot back into your normal Ubuntu desktop. Log in with your username and your new password.

What to do if recovery mode is not in the GRUB menu

On some systems, recovery mode is hidden by default. If you see only kernel versions in the GRUB menu and no recovery option, press the 'e' key to edit the selected entry. This opens a text editor showing the boot commands. Look for a line that contains ro quiet splash and change it to rw init=/bin/bash. Press Ctrl+X to boot with these changes.

This drops you directly into a root bash prompt without the recovery menu. From here, the password reset command is the same: type passwd username and enter your new password twice. After resetting, type exit to reboot the system normally.

Resetting the password if you know the current one

If you are logged in but want to change your password (rather than reset a forgotten one), you do not need recovery mode. Open a terminal by pressing Ctrl+Alt+T or by clicking the terminal icon in your process menu. Type the command passwd with no username after it. Ubuntu will ask for your current password, then prompt you to enter a new password twice.

This method is faster than recovery mode but only works if you can already log in. If you are locked out, use the recovery mode steps above.

When encrypted home directories block access to old files

Ubuntu can encrypt your home folder so that files are unreadable without your password. If your home directory is encrypted and you reset your password through recovery mode, you will be able to log in and use the system, but your old encrypted files will remain locked. You cannot decrypt them without the original password.

New files you create after logging in with the new password will be encrypted with the new password and will be readable. If you need to recover files from the encrypted folder, you would need the original password or professional data recovery help. This is a security feature, not a bug — it prevents someone who resets your password from automatically reading your private files.

Troubleshooting: what to try if the reset does not work

If you type the passwd command and get an error like "passwd: Authentication token manipulation error", the system may have a problem with its password database. Restart and try again, making sure you are in the root shell prompt (the line should start with "root@"). If the error persists, type mount -o remount,rw / to may support the file system is writable, then try the passwd command again.

If you cannot reach the GRUB menu at all, your computer may be set to skip it. Restart and try holding Escape instead of Shift, or try both keys together. On some machines, especially those with UEFI firmware, you may need to hold Shift for longer — up to ten seconds. If none of these work, you may need to boot from a live Ubuntu USB drive and use its tools to reset the password, though that is a more complex process.

Frequently Asked Questions

What if I do not remember my username?

Boot into recovery mode and drop to the root shell. Type ls /home to see a list of all user folders. Each folder name is a username on the system. Once you identify your username, use the passwd command as described above.

Will resetting my password delete my files?

No. Resetting your password only changes how you log in — it does not touch your files or settings. If your home directory is encrypted, old files will remain encrypted and unreadable, but they are not deleted. New files created after login will work normally.

Can I reset the password for a different user account?

Yes, if you reach the root shell in recovery mode. Type passwd username where "username" is the account you want to reset. You do not need to know the old password. This is why physical access to a computer is considered a security risk — anyone with access to the power button can reset any password.

What if I see "Permission denied" when I try to type the passwd command?

You are likely not in the root shell. Go back to the recovery menu and select "Drop to root shell prompt" again, or restart and try the Shift+E method to edit the boot line. Make sure the command prompt line starts with "root@" before typing passwd.

Do I need to reinstall Ubuntu if I forget my password?

No. The recovery mode method works on nearly every Ubuntu system and takes about five minutes. Reinstalling would erase all your files and settings, so it should be a last resort only if recovery mode is completely unavailable on your hardware.