Losing your root password can be quite unsettling, mostly because the root user is the most privileged user in a Linux system. This means that you will not be able to perform tasks which are a preserve for the root user. Fortunately, there exists a workaround that can help you reset a root password. In this guide, we will walk you through a step-by-step procedure of how to reset your root password on Debian 11 from the GRUB menu.
Step 1: Reboot Debian System
First, restart your Debian 11 system. As soon the GRUB menu appears, press the ‘e’ key on your keyboard on the first GRUB menu selection. This takes you to the GRUB settings.
Step 2: Edit Boot Grub Configuration
Next, locate the line that starts with ‘linux’. Navigate to the end of this line using arrow keys and just after ‘ro quiet’ append the line init=/bin/bash.
Next press ctrl + x to boot into single-user mode. This will take you into the root console. Then, modify the access right from read-only to read-write in order to reset the password. Run the following command to mount the root filesystem in ‘read and write’ mode:
$ /# mount -n -o remount,rw /
Step 3: Reset Password
After that is done, reset the root password using the following command:
The system will ask you to set a new password. Type and retype the password to confirm. If everything is okay, you should get a message that says “password updated successfully”.
To exit and reboot, press Ctrl + Alt + Del. You can now log in as the root user with the new password.
Following the steps above, you can quickly reset your root password on Debian 11. In case you cannot recall your root password, we hope that this tutorial has saved you the agony and pain and you can easily reset your password using the three simple steps that we have documented.