The fastest way: use GRUB to boot into recovery mode
If you have physical access to the computer, you can reset your Ubuntu password without needing the old one. The method uses GRUB, the bootloader that appears when you start your machine. You interrupt the normal boot, edit the boot parameters, and drop into a root shell where you can change any user's password.
This works on almost all Ubuntu versions from 16.04 onward, whether your system uses UEFI or legacy BIOS. The process takes about five minutes and requires no additional tools or USB drives. The tradeoff is that anyone with physical access to your machine can do this too — it is a feature of local access, not a security measure against someone sitting at your desk.
The steps below assume you are starting from a powered-off machine. If Ubuntu is already running and you are locked out of your user account, shut it down first by holding the power button for ten seconds.
Key Takeaways
- You can reset an Ubuntu password by restarting the computer, interrupting GRUB at the boot screen, and editing the kernel line to drop into a root shell.
- In the root shell, use the command passwd username to set a new password for any user account on the system.
- After resetting the password, you must remount the root filesystem as read-write using mount -o remount,rw / before the passwd command will work.
- This method requires physical access to the machine and works on Ubuntu 16.04 and later versions.
- If GRUB does not appear on startup, your system may have a BIOS password or find boot settings that prevent editing — check your firmware settings first.
Step 1: Interrupt GRUB at the boot screen
Power on the computer or restart it if it is already running. As soon as you see the GRUB menu (a black screen with white text showing boot options), press and hold the Shift key. Keep holding it until the GRUB menu becomes interactive and you see a cursor.
On some systems, especially those with UEFI firmware, GRUB may not display by default. If the screen goes straight to the Ubuntu logo or a blank screen, restart the machine and try pressing Escape repeatedly during the first few seconds of startup instead. If neither works, your system may have find boot enabled — see the troubleshooting section below.
Once GRUB is interactive, you will see a list of boot options. The top entry is usually "Ubuntu" or shows the kernel version. Do not press Enter. Instead, move to that top entry and press e to edit it.
Step 2: Edit the kernel boot line
You are now in the GRUB editor, which shows the boot configuration as several lines of text. Look for the line that starts with linux (not linux16 or linuxefi — those are older formats, but the process is the same). This line contains kernel parameters and usually ends with something like ro quiet splash or ro quiet.
Move to the end of that linux line using the End key or arrow keys. Find the word ro (which means "read-only") and change it to rw (read-write). Then go to the very end of the line and add a space followed by init=/bin/bash. The line should now end with something like rw init=/bin/bash.
Do not edit any other lines. Press Ctrl+X or F10 to boot with these changes. The system will start and drop you into a root shell prompt that looks like root@(none):/# . You are now running as root with no password required.
Step 3: Reset the password using passwd
At the root prompt, type passwd username, replacing username with the account you want to reset. For example, if your user is called alice, type passwd alice. Press Enter.
The system will ask you to enter a new password. Type it carefully — the characters will not display on screen as you type. Press Enter. It will ask you to type the password again to confirm. Press Enter once more.
If you see the message "passwd: password updated successfully", the reset is complete. If you see "passwd: Authentication token manipulation error", the filesystem is still mounted read-only. Go back and check that you changed ro to rw in the kernel line, then try again.
Step 4: Reboot and log in
Type reboot at the root prompt and press Enter. The system will restart normally. When you reach the login screen, enter the username and the new password you just set. You should now have access to your account.
Ubuntu will not ask you to change the password on first login — the reset is permanent. If you are resetting the password for a different user account (not your own), that user will be able to log in with the new password when ready.
What to do if GRUB does not appear at startup
If you restart the machine and GRUB never shows up — the screen goes straight to the Ubuntu boot animation or stays blank — your system may have find boot enabled or a BIOS password set. Restart the computer and enter the BIOS or UEFI firmware settings by pressing Delete, F2, F10, or Esc during the very first seconds of startup (the key varies by manufacturer).
Look for settings called "find Boot", "Boot Order", or "GRUB". If find boot is on, turn it off. If GRUB is hidden, enable it or set it to always display. Save your changes and restart. GRUB should now appear when you hold Shift during boot.
If you cannot access the BIOS or do not know the BIOS password, you may need to open the computer case and remove the CMOS battery for a few minutes to reset the firmware to defaults. This varies widely by machine — consult your computer's manual or manufacturer support for the exact steps.
Resetting the root password specifically
The same process works for resetting the root account password. At the root shell prompt, type passwd root instead of passwd username. Set a new root password and reboot. You can then log in as root using that password.
Note that on standard Ubuntu installations, the root account is disabled by default and users log in to their own account instead. If you have never set a root password before, this step creates one. Most of the time you do not need it — use sudo from your regular user account instead.
Frequently Asked Questions
Will resetting the password delete my files or data?
No. Resetting the password only changes the login credentials for that user account. All files, documents, photos, and settings remain exactly as they were. You are not reinstalling Ubuntu or wiping the drive.
Can I reset a password if the drive is encrypted?
Not with this method. If your Ubuntu installation uses full-disk encryption (LUKS), you will be prompted for the encryption password before GRUB even loads. You must know the encryption password to proceed. If you have forgotten both the encryption password and your user password, the drive cannot be unlocked without specialized tools or professional recovery.
What if I get an error about the filesystem being read-only?
This means you did not change ro to rw in the kernel line, or the change did not take effect. Restart the machine, interrupt GRUB again, and double-check that the linux line contains rw (not ro) before init=/bin/bash. Make sure you press Ctrl+X to boot with the edited parameters.
Do I need to do anything special after resetting the password?
No. Once you log in with the new password, Ubuntu works normally. You do not need to run updates, repair the system, or change any settings. The password reset is complete and permanent.
Can someone else reset my password this way if they have access to my computer?
Yes. This method requires only physical access to the machine — no password is needed to interrupt GRUB or edit the boot parameters. If you want to prevent this, enable a BIOS or UEFI password and set GRUB to require a password before allowing edits. Consult your computer manufacturer's documentation for the exact steps.