How to Reset Forgotten Root Password on Debian 11
When you are at your workplace, you might face the situation where you are an administrator of Debian servers but forgot the root password to log in to the server you own. In this situation, you can follow due process to reset the forgotten root password.
In this post, we will how to reset forgotten root password on Debian 11.
Boot System to Single User Mode
First, forcefully reboot the system and press any key to stop the boot process when the below screen shows up on your system.
Press e
to edit the kernel command line parameters.
Use the Down arrow key and go to the line that starts with the word linux. Then use the Right arrow or press the End key to go to the end of the line. Then, add init=/bin/bash
.
After adding the entry, press Ctrl + x
or F10
to boot the system.
Reset Root Password
The system will now boot into single-user mode, with the root filesystem mounted in read-only mode. So, use the mount
command to mount the root file system in read-write mode.
mount -o remount,rw /
Then, change the root user password using the passwd
command.
passwd
The reboot command will not work in this shell. So, press Ctrl + Alt + Del
to reboot your system to boot into the normal mode.
Now, you can switch to the root user with the new password.
Conclusion
That’s All. I hope you have learned how to reset forgotten root password on Debian 11.