How Do You Bypass an Ubuntu User Password?
If you are locked out of your Ubuntu user account due to a forgotten or malfunctioning password, you can regain system access by using Ubuntu’s built-in Recovery Mode. This built-in troubleshooting environment allows you to boot into a root-privileged command line where you can change the user’s password without needing the current credentials. This guide walks you through the step-by-step process of accessing the boot menu, dropping into a root shell, and updating the password so you can log back into the system normally.
Step 1: Access the GRUB Boot Menu
To begin the process, you must bypass the standard loading process and access the GRUB boot loader screen.
- Reboot the system: Restart the computer or virtual machine.
- Open the GRUB menu: As soon as the machine starts booting (immediately after the hardware manufacturer’s or BIOS/UEFI splash screen), press and hold the Shift key on physical hardware, or tap the Esc key repeatedly on UEFI systems and virtual machines.
Step 2: Boot into Recovery Mode
Once the GRUB loader menu appears on the screen, use your keyboard’s arrow keys to navigate the interface.
- Highlight the option labeled Advanced options for Ubuntu and press Enter.
- A secondary menu will display a list of available kernels. Use the down arrow key to highlight the kernel entry that has (recovery mode) written in the title and press Enter.
Step 3: Drop to the Root Shell
The operating system will load a minimal text-based background and present a menu filled with different maintenance utilities.
- Scroll down to select the option that reads root - Drop to root shell prompt.
- Press Enter to confirm, then press Enter a second time if prompted to enter maintenance mode.
Step 4: Remount the Filesystem with Write Access
By default, the recovery console mounts the operating system files as read-only to prevent accidental damage. Because a password change requires rewriting system files, you must manually change the permissions.
Run the following command in the prompt to grant write access:
mount -o remount,rw /
Step 5: Update the Account Password
Now that the disk is writable, you can assign a new login password to the specific user account.
- If you do not remember the exact username of the account, type
ls /homeand press Enter to see a list of valid user folders on the system. - Execute the password change command by replacing username
with the target account name:
passwd username - The terminal will ask you to enter a new password and then re-type it to verify. Note that Linux terminal interfaces hide characters as you type passwords for security; no characters or asterisks will display on the screen. Type the characters normally and press Enter for each prompt.
Step 6: Reboot into the Desktop Interface
After the terminal outputs a message confirming that the password updated successfully, you can leave the troubleshooting terminal and return to your regular desktop setup.
Run the final command sequence to clear system buffers and restart the machine:
sync reboot -f
The computer will perform a fresh restart, bringing you back to the standard visual login interface where you can sign in using the updated password credentials.