Table of Contents
Forgetting your Ubuntu password can lock you out of your system, but don’t worry—Ubuntu 25 allows you to reset your password safely using Recovery Mode without reinstalling the OS or losing data.
STEP 1: Reboot and Open the GRUB Menu
Restart your system and hold the Shift key (or press Esc on UEFI systems) during boot to display the GRUB menu, which allows access to recovery options.
sudo reboot
STEP 2: Enter Recovery Mode
From the GRUB menu, select Advanced options for Ubuntu, then choose the entry labeled (recovery mode) to boot into system recovery tools.
# In the GRUB menu, select:
Advanced options for Ubuntu
# Then choose:
Ubuntu, with Linux <version> (recovery mode)
STEP 3: Open Root Shell
In the recovery menu, select root – Drop to root shell prompt to gain administrative access needed to reset the password.
mount -o remount,rw /
STEP 4: Reset the User Password
Use the passwd command to set a new password for your user account.Replace username with your actual Ubuntu username, then enter and confirm the new password.
passwd username
STEP 5: Fix Home Directory Permissions (Recommended)
After resetting the password, it’s important to fix home directory ownership and permissions to prevent login issues, missing files, or desktop errors, which is a common problem after changing passwords from recovery mode.
# Replace "username" with your actual Linux username
chown -R username:username /home/username
chmod 755 /home/username
STEP 6: Reboot the System
After resetting the password and fixing permissions, restarting the system ensures all changes are applied correctly and allows you to log in normally with your new Ubuntu password.
reboot
STEP 7: Log In with the New Password
After rebooting, you can now sign in to Ubuntu normally using the new password you just set, either from the graphical login screen or via a terminal session.
login your_username
