Prerequisites
- 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 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. Continue the line with:
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.
Important Note: Ensure the password meets the system’s complexity requirements (e.g., minimum length, special characters).
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.
If you are unable to reboot, can just reset the system.
