On Debian 10, users are able to change their password pretty easily.
It is also possible, if you have sudo rights, to change user passwords as well as to define rules for password change on the host.
In this tutorial, we are going to see how you can change the user password on Debian 10 through the command-line and the user interface if you are using a GNOME desktop.
Change User Password using passwd
The first way to change the user password is to use the passwd command.
$ passwd Changing password for devconnected. Current password: New password: Retype new password: passwd: password updated successfully
If you type the same password, you are going to have a warning message saying
Password unchanged
Change Another User’s Password with passwd
Before running the passwd command, make sure that you have sudo rights on your Debian 10 host.
To check sudo rights quickly, run the sudo command and make sure that you have error messages.
$ sudo -v
If you have sudo rights, you can run the passwd command.
Note: when updating another’s user account, you are not forced to know the current user password. It is very handy if you want to restrict the access to a user.
$ sudo passwd <user> New password: Retype new password: passwd: password updated successfully
Delete Another User’s Password with passwd
Sometimes you want to reset the user password, maybe because it has lost it or because the password has been compromised.
You can set the password for the user, or you can delete the existing password to make the account passwordless.
To delete another user’s password, run the following command
$ sudo passwd -d <user> passwd: password expiry information changed
Now when logging via the GNOME user interface, you won’t be prompted with a password. The account will automatically be logged in.
Note: deleting a user password must be done under rare circumstances and the account should be updated quickly to set a secure and long password. User data might be compromised if no passwords are set for the account.
- How To Change Root Password on Debian 10
- How To Manage Root Account on Ubuntu 20.04
- How To Add A User to Sudoers On CentOS 8 | Centos 8 Add User to Group
Expire Another User’s Password with passwd
When setting a passwd on Debian, the password will never expire by default.
But sometimes, because you want to apply correct password policies, you may want to set an expiration time or to expire some accounts after a given time.
To expire another user’s password on Debian, run the following command
$ sudo passwd --expire <user> passwd: password expiry information changed
Now when logging on the other user account, it should be prompted to change its password.
Change your password on the GNOME desktop
If you are using Debian 10 with a GNOME desktop, you can modify your password via the user interface.
System administrators tend to use the command line to perform administrative operations, but nothing forces you to do it this way.
1. In the Activities search box, type “Settings” and open it.
2. In the Settings window, choose the “Details” option.
3. Choose the “Users” option, and find the user you want to modify.
4. Click on the password field. Specify your old password and change your password to a secure one.
Click on “Change” and your password should be changed. Make sure to log again to test your new password.
Troubleshooting
In some cases, you may run into some errors while changing your password on Debian 10.
Here is the list of the most common errors and their solutions.
Default root password on Debian 10
By default, there is no default password for the root account on Debian 10.
This is because the root account is locked by default and setting a root password will unlock the account.
If you forgot your root password, you will have to reset it by rebooting and starting a bash shell into the GRUB.
Forgotten password on Debian 10
If you forgot your password on Debian, you will have to reset your password using the passwd command.
If you are not the system administrator, you have to ask the admin to run the passwd command in order to reset your password and make it expire immediately.
If you are the system administrator, you can run the passwd yourself.
$ sudo passwd <user>
If you remember the root password, connect as root and change the user password over there.
$ su - $ passwd <user>
Conclusion
With this tutorial, you learnt how to change user password on Debian 10 Buster.
Another method to authenticate on a server is to use SSH keys. Make sure to check this article if you are interested in logging with SSH keys on Debian 10.
I hope that you learnt something new today.
Until then, have fun, as always.