How to reset sudo password in Debian

s2 0

If you are a new Debian administrator you might want to know how to change the sudo password in the shell. Finally, it is good security practice to regularly change passwords for each user, especially the superuser who can perform all sensitive operations under Debian. Only a 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 with the passwd command.

In this article we explain how a root user can change their own password on a Debian server.

Step 1: open the Debian command line

We need to use the Debian command line, the Terminal, to change the sudo password. Open the terminal using the Application Launcher search as follows:

You can start the Application Launcher using the Super / Windows key on your keyboard.

Step 2: Log in as the root user

Only a root user can change their own password. Therefore you have to log in as root first. To do this, enter the following command:

$ sudo -i

The system will ask you to enter the current sudo password. Please enter the password and press Enter.

You are now logged in as the root user; you can see that in the prompt.

Step 3: Change the sudo password using the passwd command

Now that you are logged in as root, you can change the passwd for the current (root) user by using the passwd command as follows:

$ passwd

Change Password

When you enter the passwd command, the system prompts you for the new UNIX root password. When you type the new password and press Enter, the system prompts you to re-enter the new UNIX root password. When you do this, the system will confirm that the password has been updated successfully.

Now whenever you need to log in as root or perform an installation and configuration process that requires root authorization, use this new password.

Step 4: Exit the root login and then the terminal

When you’re done changing the password, you can log out of the root prompt by typing the following command.

$ exit

After you have logged off, enter the exit command again to exit the Terminal application.

alternative

A simple alternative is to enter the following command, which will allow you to log in as root and enter the root password change command in a single command:

$ sudo passwd root

When you enter the above command, the system will prompt you for the new UNIX root password. When you type the new password and press Enter, the system prompts you to re-enter the new UNIX root password. When you do this, the system will confirm that the password was successfully updated.

With the help of this article, you can change the password for sudo and protect your system from malicious activity over and over again.

How to reset sudo password in Debian