How to Change Root Password in Debian 12

Root Passowrd

Keeping a strong password for authentication to login to the Debian system is quite necessary but remembering a strong password is not easy until or unless you have saved it somewhere. The root password is the one that is the authentication key for the administrator account of Linux. The administrator account has all the privileges to make changes in the system, therefore it should be hard to crack. There are various ways to change the root password on Debian 12, but in some cases to change the root password the current password is required.


How to Change Root Password in Debian 12

Losing access to the root account can add a lot of restrictions to a user when carrying out any tasks like editing any system configuration files or installation of an application that requires system data. Moreover, the root password should be changed quite after some time, as it adds more to the protection of the system. Here are the three ways to change the root password in Debian 12:

Method 1: Through Grub Menu

GRUB is one of the most used programs in almost all Linux distributions for loading and monitoring the boot process of the operating system. It only loads the kernel of the operating system, and then the rest of the work is done by the kernel. This method is feasible for users who have forgotten the password to their root account, so here are some steps for it:

Step 1: Reboot the Debian 12

If your system is running then to get to the GRUB menu you have to reboot it first and there are two ways to reboot one is by clicking on the power icon on the top right side:

The other way is much simpler, just execute the reboot command in the terminal:


sudo reboot

Step 2: Edit the Commands in Grub Menu

Once you are in the GRUB menu click e to edit the commands in the menu, these commands are executed to complete the boot process:

Now look for the command that has a Linux keyword and at the end of the command you will find ro quiet:

Now replace it with the following command in which rw gives the read and write permissions whereas the /bin/bash are used to select the bash shell that is to be used. In a nutshell, this command just gives the permissions to read and write any file in a bash shell:

rw init=/bin/bash

Once you have edited the command prompt the boot process by pressing F10 or Ctrl-x and remember to carefully write the command in this process most of the security processes are bypassed

Step 2: Check the File Systems

Once you are in the single-user boot mode, check the file system attached to the root directory as it can validate the read and write permissions exemption due to the command we used in the previous step:

mount | grep -w /

Step 3: Change the Root Password

Now change the password for the root user, although this is the root login still you have to specify the name of the root account otherwise the password won’t be changed:

passwd <root-account-name>

Upon executing the passwd command, enter the new password twice, and you will get the message for a successful change of root password for your Debian 12.

Step 4: Reboot the System

Once you are finished resetting the Debian 12 password to a new one, reboot the system by executing the init file. This file in other words is the initialization file that starts the processes from the scripts that are saved in it:

exec /sbin/init

Method 2: Through Terminal

If you know the password for your administrator account of the Debian system and want to change the password in case you have a suspicion about the password leak or want to restrict the usage of the root account yourself then execute:

sudo passwd

Another way to change the password using the terminal is by using the passwd command along with the root account name of Debian 12:

passwd <root-account-name>

Note: This method is also suitable when you want to change the passwords for other users who do not have administrator privileges.

Method 3: Through GUI

Changing the root password using the GUI of Debian 12 is relatively easy but still, you have to enter the current password, here are some steps for it:

Step 1: Go to User settings in Debian 12

Click on the application menu icon from the taskbar at the bottom to navigate to system settings:

Now click on the Users option from the options menu on the left and then click on the password:

Step 2: Change the Password

Now first enter the current password and then enter the desired password two times, the second is just for the verification:

Once you have set your new password just click on change and then reboot Debian 12 to apply the changes. It is to be noted that in this method you have to set a little bit long password as compared to the other methods.


In Debian 12 the root password can be changed either using the bootloader menu, its terminal, or from its user settings. Changing the root password in Debian 12 from the bootloader method is preferable if you have forgotten the current password. Whereas the other methods can be used if you just want to update the password to prevent any password leak or restrict the other users.

Similar Posts