This can happen quickly. You try to log into your Linux server, but the password is no longer accepted or has been forgotten. This means you can no longer access the system and important data or services. It can be really frustrating, especially if the server is needed for ongoing operations. For most Linux distributions, access can be restored via recovery mode without needing to reinstall the operating system. With the following steps, you can make your server accessible again and continue working with minimal interruptions.
To reset the password in recovery mode, the system must be started with access to the GRUB boot menu. You can reach your server’s boot console remotely via the Remote Management tab in your ZapX customer account (this replaces the previous separate iLO/IPMI login). Use this to open the GRUB menu during system startup and select Advanced options for Ubuntu.
In the next screen, select the entry that starts the system in Recovery Mode. This loads the recovery environment instead of the normal operating system.
Once the recovery menu appears, choose root – Drop to root shell prompt and confirm the selection. Press Enter again to open the root shell.
In recovery mode, the root filesystem is mounted as read-only by default. To change the password, it must be remounted with write permissions. Run the following command:
mount -o remount,rw /
If you don’t know the username, you can list all available user accounts by checking the home directories:
ls /home
To reset the password, use the passwd command followed by the username:
passwd username
Replace username with the actual account name. Enter the new password and confirm it when prompted. The password input will not be displayed on the screen. Once the password has been successfully changed, reboot the system with the command reboot.