Forgetting 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.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Linux system queries.
In this context, we shall look via a step-by-step procedure of how to reset your root password on Debian 11 from the GRUB menu.
Steps to Reset Root Password on Debian
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.
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 /
3. Reset Password
Now, 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.
[Need support in fixing Debian Linux system issues ? We can help you. ]