How to Reset a Lost Administrator Password on Ubuntu Without Reinstalling the OS
Ubuntu is widely used for its speed, simplicity, and strong security features. But if you ever forget your Ubuntu login password, you might think reinstalling the operating system is your only option. That’s not true. Reinstalling could result in lost files and wasted time.
Fortunately, there’s a simple way to reset your Ubuntu password without reinstalling the OS or deleting any data. In this guide, you’ll learn how to do that using Ubuntu’s built-in Recovery Mode.
Step-by-Step: Reset Ubuntu Password Using Recovery Mode
Ubuntu includes a feature called Recovery Mode that allows you to troubleshoot system problems. One of its powerful uses is resetting a forgotten password.
Step 1: Start Your Computer
Turn on your computer. When the GRUB boot menu appears, stop and wait.
If you don’t see it, hold the Shift
key (on BIOS systems) or Esc
key (on UEFI systems) right after powering on.
From the GRUB menu, select:
Advanced options for Ubuntu
Step 2: Select Recovery Mode
In the next screen, choose a kernel version with (recovery mode) in the name and press Enter
.
Step 3: Enter Root Shell
From the recovery menu, select the option called:
root – Drop to root shell prompt
This opens a terminal with administrative access.
Step 4: Remount the File System with Write Access
By default, the system is in read-only mode. To make changes, run this command:
mount -o remount,rw /
This enables write access so you can update the system.
Step 5: Reset the Password
Now, change your user password with the following command:
passwd your_username
Replace your_username
with your actual Ubuntu username.
When prompted, enter a new password, then re-enter it to confirm.
If you’re unsure of your username, you can list all users with:
ls /home
Step 6: Reboot the System
After successfully changing the password, restart your computer:
reboot
You should now be able to log in using your new password.
Final Thoughts
This method is a safe and efficient way to recover access to your Ubuntu system. It doesn’t require reinstalling the OS or deleting any of your files.