How to Reset a Lost or Forgotten Password on Ubuntu Server
You can reset a forgotten Ubuntu server password by booting into recovery mode, this lab shows you how.

The Goal
To regain access to an Ubuntu server when the password has been lost, forgotten, or left behind by a departing sysadmin. This lab shows how to reset it using Ubuntu’s recovery mode—no installation media or ISO required.
The Lab
This lab is also available on YouTube
- Server: Ubuntu, physical or virtual
- Access: Console access—either direct or via hypervisor
- Mode: Recovery mode and root shell access
The Why
Passwords get lost. Admins move on. And sometimes a beautifully functioning home lab is rendered inaccessible by a simple case of forgetfulness. Ubuntu's recovery mode offers a built-in rescue path for just such moments—and all it takes is a few commands.
The How
1. Boot into Recovery Mode
- Reboot the server
- Hold
Shift
during boot to access the GRUB menu (on some systems, it’sEsc
) - Choose the kernel entry with
(recovery mode)
- Press
Enter
to boot
2. Drop to Root Shell Prompt
- Once the recovery menu loads, select "root – Drop to root shell prompt"
- Press
Enter
You’ll now be logged in as root—but in read-only mode.
3. Remount the File System
To enable write access:
mount -o remount,rw /
This remounts the root filesystem with read-write permissions so you can update passwords.
4. Reset the Password
For the root user:
passwd
For a specific user (e.g. rajinder
):
passwd rajinder
You’ll be prompted to enter and confirm a new password.
5. Reboot the Server
reboot
After rebooting, use the new password to log in.
The Results
- Password successfully updated.
- You’ve regained access to the server.
- No ISO images, no reinstall, no downtime.
Whether it's a production box or your home lab, this method is quick, clean, and built right into Ubuntu.
The Conclusion
Recovery mode on Ubuntu is a lifesaver for forgotten passwords. When you've done it once, it's surprisingly straightforward. And while your manager may not throw a parade, you will have avoided a rebuild and kept the server operational.
Using a VPN is a secure and simple way to protect your data.
If you'd like to support my work, show your appreciation!
Comments ()