Debian

How to Reset Forgotten Root Password in Debian 11

It is common for Linux users to forget the root password, but forgetting the password is annoying. This mostly happens when you have not switched to the root user for a prolonged time. It is necessary to remember the root password to access the system and make it work properly.

In this tutorial, we have demonstrated the guidelines for resetting the root password in Debian 11.

How to Reset Forgotten Root Password in Debian 11

Here are the steps to reset the forgotten root password in Debian 11:

Step 1: First, you must access the Grub Menu to reset the forgotten root password in Debian 11. Restart the system and press the shift key while restarting the device.

Step 2: The next step is to edit the grub menu, and press the e key when this screen appears:

Step 3: Use the arrow keys to move up and down on the editing screen. Scroll down the menu until you move to the line that starts with Linux. Look at the end of this line you will find ro quiet, you have to edit this string.

Step 4: Replace the string with init=/bin/bash at the end of the line as shown in the screenshot:

Step 5: Next, you have the root access of the Debian system, mount the root file system with the read and write permission by executing the following command:

mount -n -o remount,rw /

Step 6: Now change the root password via the following command:

passwd

Step 7: Enter the new password twice and hit Enter. The message will pop up “Password updated successfully”:

Step 8: Exit the single-user mode and reboot the system normally. You can now log in with your new root password on Debian.

Bottom Line

Resetting a forgotten password in Debian 11 isn’t a simple task. However, the users can follow the step-by-step guidelines presented in this article to quickly reset the forgotten root password in Debian. Make sure to write the updated password somewhere so that you don’t need to reset the password again.

About the author

Zainab Rehman

I'm an author by profession. My interest in the internet world motivates me to write for Linux Hint and I'm here to share my knowledge with others.