How to Change Root Password on Debian 12

Passwords are used on user accounts or social accounts to secure the account and social account respectively from unauthorized users. In Linux distributions including Debian, the root users are the super users that are allowed to manage the administrative tasks on the computer. 

The root user account is protected by the password that is set at the time of the installation of Debian. It is suggested to store the password in some personal notepad on mobile or some other platform. In case, if the password of the root user is forgotten, it can be retrieved easily.

However, if the root password is not stored anywhere and the password has been forgotten, it can be reset by the method explained in this post. 

How to Reset the Root Password on Debian Linux Using the Grub Menu?

To reset the password on Debian, follow the instructions explained in the next-mentioned steps. 

Step 1: Restart the Computer

To reset the password, restart the computer by clicking on its option as shown in the figure below:

Step 2: Open the Grub Menu

When the computer is restarted, a screen will be displayed of the Grub menu:

This menu will appear on the screen for a few seconds and then it will proceed towards the login screen which is set by default. To hold the menu, press the arrow key either above or down. 

Step 3: Open the Grub Menu Editing Screen

The next step is to press the “e” key from the keyboard to open the editing screen of the Grub menu:

Step 4: Make Changes in the Boot Script

Now a script-like file will be opened on the screen which are the instructions for booting the computer. When the screen is opened, scroll down the file with the down arrow and locate the “Linux” word in the file. After the “ro quiet” add the “rw init=/bin/bash” line as shown below:

This line will grant you the read and write rights on the “init” file placed in the/bin/bash directory. After adding this line, the computer must boot again with the F10 shortcut key. 

Step 5: Reset the Password

Now a command line interface will be displayed on the screen, run the below-mentioned command:

#  passwd

Set the new password and then restart the computer by executing the command:

# exec /sbin/init

Now login to the root user account with the new set password and it will confirm that the password is successfully changed. 

How to Change the Root Password on Debian Linux?

It is a good practice to change the password of the root users frequently after a specific period. For this purpose, different possible methods for changing the password of root and other users are explained in the following article:

This is all about resetting or changing the password of the root users on Debian. 


To change the root password on Debian 12 use the passwd command or navigate to the “Settings” menu. If the root password is forgotten, then access the grub menu to reset it. 

This post explained the methods to change the root password or reset it from the Grub menu with the step-by-step guide.