Article Directory
Steps to reset a forgotten root password on Debian 11
Open the Debian 11 Grub menu
To reset the password, first, we have to access the Grub menu of Debian 11 Bullseye. Restart the system while holding down the Shift key on the keyboard. This will bring you to Debian 11's Grub menu.
This step is to restart the system, if it has been shut down, go directly to the next step
Edit Gurb menu to reset root password
The next step is to edit the default boot entries for Debian 11. To do this, press the "e" key on your keyboard. This will allow you to edit Grub's boot prompt. Do not touch or delete anything here. Once you let the editor move on to the next step.
Add torw init=/bin/bash
On the Grub editing screen, use the arrow keys to move to the end of the line beginning with "Linux". At the end of this line type rw init=/bin/bash
as shown in the given screenshot.
rw init=/bin/bash
After adding the given syntax, next, start your system with this configuration. To do this, use Ctrl+X
or F10
.
Debian 11 root shell access
Now, without providing any password, you will have a Debian 11 shell with root access. Here, first let's check that our user has read and write permissions to the file system where the operating system is installed.
Use the command for this:
mount | grep -w /
If the output is:
( rw,realtime
) means you have real-time read and write access to the file system.
reset root user password
Now, let's change the password using the command terminal as we do on a Linux system.
input the command:passwd
You will be prompted twice to add a new password:
Reset Root Password in Debian 11 Buslleye
To change the password of other user than root, we have to mention the same username. For example, if our system username is Debian and we want to change its password, the command would be:
grammar:passwd username
example:passwd debian
reboot your system
After you finish resetting your Linux password, reboot your system to log in with the changed password. To restart, type:exec /sbin/init
Then press Enter.
From here, you can log in and access your system with your newly set root password. This guide is useful for those who have lost or forgotten their root password for some reason and now want to change it. The steps given in this article should also work on other Debian 11 releases.