Search Our Database
How to reset a lost admin password in Ubuntu
Introduction
Forgetting the admin (root) password on an Ubuntu system can seem daunting, but the recovery process is straightforward. By using Ubuntu’s recovery mode and accessing a root shell, you can regain control and reset the password without needing to reinstall the operating system. This guide provides detailed steps to help you recover access to your system efficiently, whether you’re working on a personal computer or a remote server. Resetting the admin password ensures that you can quickly resume managing your system with minimal disruption.
Prerequisites
Before you begin, ensure that:
- You have physical access to the machine or virtual console if using a virtual server.
- The system is running Ubuntu or a similar Linux distribution.
Step-by-step Guide
Step 1: Reboot the System and Access GRUB
- Restart your machine and hold down the Shift key as it boots up. This will bring up the GRUB bootloader menu. If GRUB doesn’t appear, it may be hidden by default, so make sure to press the Shift key early during the boot sequence.
Step 2: Enter Recovery Mode
- In the GRUB menu, use the arrow keys to highlight the Ubuntu boot option.
- Press e to edit the selected boot entry.
- Find the line that begins with linux and ends with ro quiet splash. Change this line to:
rw init=/bin/bash
This modification will boot the system with read/write permissions and open a Bash shell.
Step 3: Boot into Root Shell
- After editing the GRUB entry, press Ctrl + X or F10 to boot with the modified settings. This will boot into a root shell without asking for a password.
Step 4: Reset the Admin Password
- At the root prompt, type the following command to reset the admin password (replace username with your actual admin username):
passwd username
- You will be prompted to enter a new password. Type the new password and confirm it when asked.
Step 5: Remount the Filesystem as Read-Only
- Before rebooting the system, remount the filesystem as read-only to avoid filesystem corruption. Run the following command:
mount -o remount,ro /
Step 6: Reboot the System
- Now reboot the system by typing:
reboot
Your system will restart, and you should now be able to log in with the newly reset admin password.
Conclusion
This guide shows how to recover a lost admin password on Ubuntu by booting into recovery mode and using a root shell to reset the password. This method is effective for both physical and virtual machines where GRUB access is available.
If you encounter issues or have any further questions, feel free to reach out to your support team for assistance.
Should you have any inquiries about the guidelines, please feel free to open a ticket through your portal account or contact us at support@ipserverone.com. We’ll be happy to assist you further.