If you are a new Debian administrator, you can learn how to change the sudo password in the shell. In the end, it is recommended that you regularly change passwords for any user, especially for the superuser who can perform all the important operations in Debian. Only superuser or root can change the password for any user account. Other users can only change their own passwords.
User passwords are changed in Debian using the passwd command.
In this article, we will explain how the root user can change his password on the Debian server.
Step 1: Open the Debian Command Prompt
We need to use the Debian, Terminal command line to change the sudo password. Open Terminal through a search in the Application Launcher as follows:
You can launch Application Launcher using the Super / Windows key on your keyboard.
Step 2: Log in as root
Only the root user can change their password. Therefore, you need to log in as root first. To do this, enter the following command:
$ sudo -i
The system will prompt you to enter the current sudo password. Please enter your password and press Enter.
You will now be logged in as root; You can see this on the command line.
Step 3: Change the sudo password with the passwd command
Now that you are logged in as root, you can change the passwd for the current (root) user using the passwd command as follows:
When you enter the passwd command, the system asks for a new UNIX root password. If you enter a new password and press Enter, the system will prompt you to enter the new UNIX root password again. If you do, the system will confirm that the password has been successfully updated.
Now, when you need to log in as the root user or perform any installation and configuration operation that requires root user authorization, you will use this new password.
Step 4: Log out of the root login and then Terminal
When you are done with changing the password, you can exit the root command prompt by entering the following command.
Once you log out, enter the logout command again to exit the terminal application.
A simple alternative is to enter the following command, which will allow you to log in as root and enter the password change command for root, with one command:
$ sudo passwd root
When you enter the above command, the system will prompt you to enter a new root password on UNIX. When you enter a new password and press enter, the system will prompt you to enter a new root password on UNIX. After that, the system will confirm that the password has been successfully updated.
With this article, you can change the password for sudo and protect your system from any malicious activity over and over again.
How to reset sudo password in Debian