Change your Linux password easily

To best manage your own user account or the accounts of other users, it is helpful to know the most important utilities of Linux. This includes passwd, which you can use to change your Linux password, among other things. You can learn the individual steps here.

The passwd command in Ubuntu

The passwd program package, which allows you to easily change your own password or the passwords of an entire group, as well as set other commands, is included in most Linux installations. Our guide refers to the Ubuntu installations - Ubuntu is one of the most versatile, free distributions of Linux with long-term support and biannual updates.

Tip

If you are not sure which Linux distribution or version you are using, see our article on how to display your Linux version.

Change your own Linux password

If you want to change your own Linux password, this is a relatively straightforward process.

  1. Open the Linux terminal. This is where you normally enter commands.
  2. Now type the command “passwd”. This is how you tell the system that you want to change your Linux password.
  3. Depending on the version, you may be prompted to enter your old password. In response, simply enter your new password and confirm it again.
  4. If you now try to log into the system, the new password will be valid.

 

$ passwd
Enter a new UNIX password:
Re-enter the new UNIX password:
passwd: Password successfully changed
$
Fact

Changing passwords regularly was once one of the top recommendations for keeping safe online. However, this long-standing advice has been withdrawn, as changing passwords frequently can weaken security. Therefore, it is advisable to only change a password if the password is considered “compromised” or too weak.

Change a Linux password for one user

If you want to change the password of another user, then you need the root privileges. This means that you are the only user of the computer who has unlimited rights to all system files and resources. Keep your password ready for this reason.

  1. To change a user password, access the terminal and type “sudo passwd <username>”.
  2. Follow the steps in the previous example: enter new password and confirm by typing it again.
  3. If the password is set, the respective user must use the new password at the next login.

 

$ sudo passwd username
Enter a new UNIX password:
Re-enter the new UNIX password:
passwd: Password successfully changed
$

Force Linux password change at next log in

Sometimes a system administrator needs a user to change their password immediately. This can be for various reasons. There may be a user change for an account, or a password may have fallen into the wrong hands. In this case, enter the following syntax as an administrator: “-e passwd <username>”. Here, “-e” stands for “expire” and causes the respective password to expire immediately, so that the affected user must set up a new password the next time they log in.

Tip

We have collected the most important Linux commands for you in our article.