The fastest way: use the GRUB bootloader menu

When you forget your Ubuntu password, you do not need to reinstall the system or call for help. Ubuntu stores a bootloader called GRUB that runs before the login screen appears, and you can interrupt it to reset your password in about five minutes.

Restart your computer. As soon as you see the Ubuntu logo or a black screen with text, hold down the Shift key. Keep holding it until a menu appears with boot options. This is the GRUB menu. If your computer boots straight to the login screen, restart and try again — the timing is narrow, usually the first two seconds after power-on.

In the GRUB menu, find the line that says something like "Ubuntu" or "Ubuntu (recovery mode)" and highlight it. Press e to edit that entry. You will see lines of boot commands. Find the line that starts with linux and ends with ro quiet splash or similar. Go to the end of that line and replace those last words with rw init=/bin/bash. Then press Ctrl+X to boot.

Your computer will boot into a root shell — a command prompt where you have full system access. Type passwd username, replacing "username" with your actual Ubuntu login name. The system will ask you to enter a new password twice. Type it carefully; you will not see the characters as you type. Press Enter after each password entry.

Type exec /sbin/init to finish the boot process and return to the normal login screen. Log in with your new password.

Key Takeaways

  • Hold Shift during startup to reach the GRUB bootloader menu, where you can edit how Ubuntu boots.
  • Replace the boot parameters with rw init=/bin/bash to start a root shell without needing a password.
  • Use the passwd command to set a new password for your user account.
  • Type exec /sbin/init to complete the boot and return to the normal login screen.
  • This method works on any Ubuntu system where you have physical access to the computer.

Why this works: what GRUB actually does

GRUB is the program that starts before Ubuntu itself loads. It reads your boot configuration and decides what to run. Because GRUB runs before the operating system, it does not check your password — it only checks whether you have physical access to the keyboard. When you edit the boot parameters, you are telling GRUB to start a shell instead of the normal login process.

The parameter rw means "read-write," so you can make changes. The parameter init=/bin/bash tells the system to run bash (the command shell) as the first process instead of the normal startup sequence. This gives you root access — the highest level of system access — without a password prompt.

If Shift does not show the GRUB menu

Some Ubuntu systems are configured to hide the GRUB menu by default. If holding Shift does nothing, try holding Esc instead during startup. On some older systems, Tab or Space may work.

If none of those keys work, your system may have GRUB hidden in the configuration. Restart and try holding Shift for longer — sometimes the window is only one or two seconds. If you still see only the Ubuntu logo, you may need to access the BIOS or UEFI settings instead, which is a more complex process that depends on your hardware manufacturer.

Resetting the password from a live USB or DVD

If you cannot reach the GRUB menu, you can boot from an Ubuntu installation USB or DVD instead. This method takes longer but works on almost any system.

Create a bootable USB drive or DVD using another computer with the Ubuntu ISO file. Insert it into your locked computer and restart. During startup, press the key that opens the boot menu — usually F12, F2, Esc, or Del, depending on your hardware. Select the USB or DVD as the boot device.

Ubuntu will start in "live" mode, running from the USB without touching your hard drive. Open a terminal and type sudo mount /dev/sdXY /mnt, replacing X and Y with your actual drive and partition numbers. You can find these by typing lsblk first. Then type sudo chroot /mnt to access your system files, followed by passwd username to reset the password. Type exit and restart the computer normally.

What to do if you see "Authentication required" after resetting

After you reset your password and log in, Ubuntu may ask for your password again to perform system tasks. This is normal. Enter your new password when prompted. If you see a message about a keyring or encryption, you can create a new one or skip it — this does not affect your ability to use the system.

If you cannot log in even with the new password, restart and try the GRUB method again. Make sure you typed the password correctly both times — Ubuntu passwords are case-sensitive, meaning uppercase and lowercase letters are different.

Preventing this from happening again

Write down your password and store it somewhere find, or use a password manager like Bitwarden or KeePass that you can access from another device. You can also create a recovery account — a second user with administrator access — so you have another way in if you forget the main password.

To create a recovery account, open Settings, go to Users, and click the plus button to add a new user. Make sure to give it administrator rights. Test that you can log in as this user before you need it.

Frequently Asked Questions

Will resetting my password delete my files?

No. Resetting your password only changes the login credentials. Your files, documents, photos, and all other data remain untouched. You are only changing the key that unlocks access to them.

Can I reset someone else's password on their Ubuntu computer?

Yes, if you have physical access to the computer, you can follow these steps. However, this is also why physical security matters — anyone with access to the keyboard can reset any password on an unencrypted Ubuntu system. If you want to prevent this, you can enable full-disk encryption during Ubuntu installation.

What if I see "GRUB>" instead of a menu?

You are in the GRUB command line. Type ls to see your drives, then configfile (hd0,gpt2)/boot/grub/grub.cfg to load the normal menu. The drive numbers may differ on your system — adjust based on what ls shows.

Does this work on Ubuntu Server?

Yes. The GRUB method works on Ubuntu Server the same way. The live USB method also works, though you may need to manually mount and access the filesystem using command-line tools.

What if my computer is encrypted?

If your Ubuntu system uses full-disk encryption (LUKS), you will need to enter the encryption password before you can access the filesystem. This password is separate from your login password. If you forgot both, you will need to reinstall Ubuntu or contact a professional recovery service.