Debian 12 is the latest and most popular release with the Linux kernel 6.1, GNOME 43, and the updated packages across the board. Setting a password is the authentication process to use the system’s resources with different permissions like root(admin privileges) or simple user(with fewer permissions). To change the password in the Debian 12, you can use multiple methods as mentioned below:

  • Change Password Using CLI
  • Change Password Using GUI
  • Change Password While Rebooting

This guide explains the process of changing the password in the Debian 12 system.

Method 1: Change Password Using CLI

To change the password using the Command Line Interface or CLI, use the “passwd” command with the user’s name. After that, enter the current password and then enter the new password twice for the user to confirm the change. To learn the process in detail, simply go through the following sections:

Change User’s Password

Start the process by visiting the terminal from the Debian machine and entering the “passwd <user>” command. Change the <user> with the actual name of the user on your machine as mentioned below and hit enter:

passwd user

Running the above command asks the user to type the current password of the user for its authentication and hit enter:

After the authentication, simply set the new password for the user by typing it in the “New password:” section and hit enter again:

Now, again type the new password to confirm it in the “Retype new password:” section and execute it using the enter key from the keyboard:

Executing the above configurations updates the password with the success message as displayed in the following screenshot:

The above section has updated the password for the <user> without accessing the root user or admin privileges. Now, let’s access the root user and change its password using the following section:

Change Root’s Password

To get the administrative privileges and access the root user, simply execute the following command:

su -

Executing the above command prompts the user to enter the password for the root user and hit enter:

Inside the root user, run the following command to set the new password in the Debian machine:

passwd

Running the above command prompts you to enter the new password and hit enter from the keyboard:

Again, type the password for the root user to confirm the process and hit enter at the end:

Hitting enter updates the password for the root user as displayed in the following screenshot:

Now, we have learned how to change the password for both(root and user) users with the help of commands. Now, we can simply delete the user’s password from the root user, and its process is explained below:

Delete User’s Password From Root

In the root user, execute the passwd command with the “-d” flag to delete the password of the user using the following command:

sudo passwd -d user

The following screenshot displays that the password is deleted or changed successfully:

Another flag that can be used to delete the password is the “–expire” with the passwd command as mentioned below:

sudo passwd --expire user

The password has been changed or deleted in this case as confirmed with the help of the following snippet:

After that, simply reboot the system to implement the changes of deleting the password:

reboot

Set User’s Password

After deleting the user’s password, you need to set a new password as the login window asks. The following screenshot displays that you need to set the password for the user to log in to the user:

To set the password for the user, simply type the password in the tab highlighted in the following screenshot:

After that, it asks the user to retype the password to confirm the process and hit enter to complete the process:

The following screenshot displays that you have successfully updated the password and logged in using the new password:

The first method has explained the process of changing the password using the commands in the terminal. Now, simply use the Graphical User Interface or GUI to change the password of the Debian’s user or the users. To do so, simply visit the Settings page and open the Users page from the left panel of the page. After that, open the password page to change the password from there, and confirm the process by clicking on the “Change” button:

Learn the process of changing the password using GUI in detail with the help of the following section:

Method 2: Change Password Using GUI

To change the password in Debian using GUI, simply locate and click on the “Settings” icon by searching it from the “Activities” page:

Clicking on the “Settings” icon brings you to its page and from there you need to click on the “Users” page from the left panel. From the “Users” page, click on the “arrow” button from the “Password” tab as mentioned below:

Type the current password to confirm the authenticity of the user, and then type the new password twice. After that, simply click on the “Change” button from the top of the window to confirm the process of password change:

We have changed the password using the GUI and CLI commands but for that, you require the existing password. However, changing the password when you can’t remember the existing password can be done by setting it as the time of boot. The following methods explain the process in detail with the help of commands and screenshots:

Method 3: Change the Password While Booting

To change the password at the time of booting, simply select the “Debian GNU/Linux” option from the GNU GRUB menu. After that, simply press “e” from the keyboard to edit the commands before booting:

Hitting “e” opens the following page and from there you need to locate the Linux line at the end of the page:

Visit the line by navigation arrows from the keyboard as displayed in the above snippet:

After that, change the “ro quiet” from the end of the line as mentioned in the above screenshot and replace it with the following command:

init=/bin/bash

After changing the above configurations, simply press “F2” or “Ctrl + X” from the keyboard:

Saving the above configurations displays the following screenshot to write the commands and change the password of the user:

Execute the following command to remount the root directory making it readable and writable:

mount -o remount,rw /

The following screenshot displays the success message as the root directory is remounted:

Now, remount the /proc files from the directory using the following command:

mount -o remount,rw /proc

After that, type the following command to set the password for the root user:

passwd

Type the new password twice and hit enter to confirm the password for the user:

The following screenshot displays the successful message as the message is updated for the root user:

After updating the password, simply click the “Ctrl + Alt + Delete” keys from the keyboard to reboot the system.

That’s all about the process of changing the password with multiple methods like CLI or GUI.

Conclusion

To change the password in the Debian 12 machine, simply use the “passwd” command in the terminal or change it through the settings page using GUI. To change the password, you need to type the existing password and then type the new password twice. If you don’t know the existing, simply reboot the system and change the command before booting to set the password. After that, reboot again and login to the system using the new password.