Once you add a general user into the sudo group, then there is no need to use a root account for the administrative tasks. But due to some odd reason, you are not able to access your primary account?
In that case, the root account can be a savior. But unfortunately, you are not getting the root password too. Now the only way is to reset the root password.
Today, you will learn to reset the root password in Debian 10/11 with a few simple steps.
Table of Contents
Reset forgetten root Password
In a simple three steps, you can reset the root password, and the steps are as follows.
Reboot to Grub Bootloader
The foremost step is to restart your system into a grub menu. Once the boot menu appears, select the respective boot partitions in case of multiboot and press e to edit the kernel command line parameter.
In the next screen, you need to find a line containing “ro quiet” and replace ro with rw, and after quiet, add a shell script location init=/bin/sh.
Once it is done, press Ctrl-X or F10 to boot into chroot environment.
If everything is executed as per our instructions, you will see a shell with the pound symbol #. over here, type passwd command to change the root user password.
Enter a new password for confirmation, type once again. If the password gets matched, you will see a message on stdout “passwd: password updated successfully”.
The reboot and shutdown command will not work here, so press Ctrl+Alt+Del to reboot your system to regain your root privileges.
If the above method didn’t work out for you, and it prints some kind of error like “passwd: Authentication token manipulation error”.
To resolve this error, type the below command:
# mount -o remount,rw /
After that, type the passwd command to replace the root password and perform the reboot.
The above method should regain your password for the root account. And I believe this method will work on Debian 10/11 and Bedrock Linux.
A man with a tech effusive who has explored some of the amazing technology stuff and is exploring more. While moving towards, I had a chance to work on Android development, Linux, AWS, and DevOps with several open-source tools.