To reset a forgotten Ubuntu password, you'll need to reboot the system and access the GRUB boot menu to enter recovery mode or edit the boot parameters. The exact steps differ slightly between Ubuntu versions with GRUB (most desktop and server installs) and those using full disk encryption. This guide covers the standard GRUB method that works on Ubuntu 18.04 and newer, including 24.04 LTS.

What You'll Need

  • Physical or console access to the Ubuntu machine (keyboard and monitor, or a remote console like iDRAC/IPMI).
  • The system's boot drive must not be fully encrypted with LUKS (if it is, you'll need the encryption passphrase to proceed past the decryption prompt).
  • A few minutes of downtime – the system will need to reboot.

Step-by-Step

  1. Reboot the system. If the machine is on, restart it. If it's off, power it on.
  2. Hold Shift (or press Esc repeatedly) during boot. As soon as the system starts, press and hold the left Shift key (or tap Esc on some UEFI systems) to bring up the GRUB boot menu. If you see the Ubuntu logo, you missed it – let it boot fully, then reboot and try again.
  3. Select the “Advanced options for Ubuntu” entry. Use the arrow keys to highlight it and press Enter.
  4. Choose a kernel with “(recovery mode)” in its name. For example, “Ubuntu, with Linux 6.8.0-31-generic (recovery mode)”. Press Enter.
  5. Wait for the recovery menu to appear. It may take a minute or two. You'll see a blue menu with options like “resume”, “clean”, “dpkg”, “fsck”, “grub”, “network”, “root”, and “system-summary”.
  6. Select “root”. This drops you to a root shell (a command prompt). If it asks for a password, you may be out of luck – that means the root account is locked (which is default) and you'll need the alternative method below (Step 10).
  7. Remount the filesystem as read-write. At the root shell, type the following and press Enter:
    mount -o remount,rw /
    This makes the system drive writable so you can change the password.
  8. Reset the password for your user account. Replace username with your actual Ubuntu username (e.g., john). Type:
    passwd username
    You'll be prompted to enter a new password twice. Choose something strong and memorable.
  9. Exit the shell and resume boot. Type exit to leave the root shell, then select “resume” from the recovery menu. The system will continue booting normally. You can now log in with your new password.
  10. If the recovery menu asks for a password or doesn't work (alternative method): Reboot again, get to the GRUB menu (Step 2), but instead of recovery mode, highlight the normal kernel entry (e.g., “Ubuntu”) and press e to edit the boot parameters.
  11. Find the line starting with linux. It will look something like linux /boot/vmlinuz-... root=UUID=... ro quiet splash. Use the arrow keys to move to the end of that line.
  12. Replace ro with rw init=/bin/bash. Delete ro and type rw init=/bin/bash in its place. The line should now end with quiet splash rw init=/bin/bash (or similar).
  13. Press F10 or Ctrl+X to boot. This will drop you directly to a root shell (no password prompt).
  14. Reset the password. Type passwd username (replace with your username), enter the new password twice, then type exec /sbin/init to continue booting normally. If that doesn't work, type reboot -f to force a restart.

Common Mistakes

  • Not remounting the filesystem. If you skip mount -o remount,rw / in recovery mode, the system drive stays read-only and the passwd command will fail with a “Read-only file system” error.
  • Using the wrong username. If you're not sure of your username, type ls /home in the root shell to see the home directories – the folder name is usually the username.
  • Holding Shift too late. On UEFI systems, the Shift key must be pressed immediately after power-on, often before the manufacturer's logo appears. If you miss it, reboot and try again.
  • Typing the password twice incorrectly. The passwd command will tell you if the passwords don't match – if so, it asks again. Be careful with keyboard layout if you're using a non-US keyboard.
  • Forgetting to exit recovery mode properly. If you just power off after changing the password, the system may not have synced changes. Always use exit and then “resume”.

Tips

  • Write down your password. After resetting, store it in a secure password manager to avoid a repeat.
  • Use a strong but memorable password. A passphrase like “correct-horse-battery-staple” is both strong and easier to remember than a random string.
  • If you have full disk encryption (LUKS), you'll need the encryption passphrase to get past the decryption prompt before you can reach GRUB. If you've forgotten that too, you cannot reset it without wiping the disk – there is no backdoor.
  • For remote servers, use the provider's web console (e.g., VPS control panel) to access the recovery mode, as you won't have physical access.
  • After resetting, consider setting up SSH key authentication for future access, so you don't need to remember a password for remote logins.

Troubleshooting

GRUB menu doesn't appear. On some systems, especially with fast boot, the Shift key may not work. Try pressing Esc repeatedly instead. If that fails, you can force the menu to show by editing the GRUB timeout – but that requires booting normally first. Alternatively, use a live USB to chroot into the system (more advanced).

Recovery mode asks for a password. This happens if the root account has been manually unlocked. In that case, you'll need to use the alternative method (Step 10) – editing the kernel command line to boot into a root shell.

“passwd: Authentication token manipulation error”. This usually means the filesystem is still read-only. Re-run the remount command and check for errors.

System boots to a black screen after editing GRUB. If you typed something wrong in the kernel line, the system may fail to boot. Reboot and edit again, making sure you only replaced ro with rw init=/bin/bash and didn't delete other parts.

You don't know your username. In the root shell, run ls /home to list user home directories. The folder name is usually the username. If it's empty, check cat /etc/passwd for entries with a home directory under /home.

If all else fails, boot from an Ubuntu live USB, mount the system partition, and chroot into it to reset the password. This is more involved but works on any system where you can boot from external media.

Frequently Asked Questions

Can I reset the root password instead of a user password?

Yes, the same steps work for the root account if it's enabled. But by default, Ubuntu locks the root account, so you'd typically reset a regular user's password.

Will this work on Ubuntu Server?

Yes, the GRUB method works on Ubuntu Server as long as you have console access. The steps are identical.

Does this work if I have full disk encryption?

Only if you know the encryption passphrase. If you've forgotten that, you cannot reset any password without wiping the disk.

Can I reset a password without rebooting?

If you have sudo access to an existing account, you can run sudo passwd username from a terminal. This guide is for when you're locked out.

Will my files be affected?

No, resetting the password only changes the authentication data. Your files, settings, and installed programs remain untouched.

How long does this take?

Usually 5–10 minutes, including reboot time. The actual password change takes seconds.