Scenario
You inherit an Ubuntu Server from a departing sysadmin. Everything is running smoothly until you try to log in. The password is missing, outdated, or simply forgotten. With no SSH access and no documentation, the server is effectively locked.
Reinstalling Ubuntu isn’t an option. The server hosts important workloads, and you need access now.
Fortunately, Ubuntu includes a built‑in recovery mode that lets you reset any user password directly from the console. No external tools, no live ISO, and no data loss.
Lab Objectives
- Boot Ubuntu Server into recovery mode
- Access a root shell
- Remount the filesystem with write permissions
- Reset any user password
- Reboot and log in successfully
Prerequisites
- Ubuntu Server (physical or virtual)
- Console access
- Ability to reboot the machine
Boot Into the GRUB Menu
- Reboot the server.
- As the system starts, hold Shift (BIOS) or press Esc (UEFI) to display the GRUB menu.
- Select:
Advanced options for Ubuntu
- Choose the entry that ends with:
(recovery mode)
This boots Ubuntu into its built‑in recovery environment.
Drop to a Root Shell
In the recovery menu, select:
root – Drop to root shell prompt
You now have root access but the filesystem is mounted read‑only by default.
Remount the Filesystem as Read/Write
Run:
mount -o rw,remount /
This allows you to make changes, including resetting passwords.
Reset the Forgotten Password
Use the passwd command to reset the user’s password:
passwd username
Enter the new password twice.
If successful, you’ll see:
password updated successfully
Reboot the Server
Exit the shell and reboot:
reboot
Once the system restarts, log in using the new password.
Conclusion
You’ve successfully regained access to an Ubuntu Server using recovery mode, a built‑in rescue path designed for exactly this situation. This method is fast, safe, and requires no installation media or external tools.
It’s an essential skill for sysadmins, homelab builders and anyone responsible for maintaining Linux servers.