Manage user keys with passwd

Many user accounts can exist on an operating system, each with its own password. Modify them on Linux, has no major complication. If you have needed it, here is a command for managing user keys from the console: Passwd.

The command Passwd is used for change the password of a user account. It is a multifunction command and in some way scalable. A regular user, I can only change the password of his account, while a user with superuser permissions can change the password of any account in the system. as well as defining a control over the expiration of each key and how often it should be changed. For example, how long does it take for the key to expire and a new password must be defined.

To change the password for the current user, first open a terminal and run:


at first enter the current password of the account.

(current) UNIX password:

When entering it (and if it is correct of course this) you must now enter the new password for the account, and once again as confirmation.

Enter the new UNIX password: Retype the new UNIX password::

If the passwords match, then congratulations, you've just changed the user password.

Changing the passwords of other users

If you have superuser privileges, then you can change the password of other system users. We will add the prefix "sudo", to enter the terminal as a super user. In general, Passwd, maintains a syntax similar to this

passwd [OPTIONS] [USER]

where the options available are:


If we suppose that the system has the users User1, User2 and User3, and would like to change the password of User2. We execute in the command line:

sudo passwd User2

and after entering the new password, under a process similar to the previous one, the User2 password will have been changed from your user, through superuser permissions.

There are various functions that passwd has, change / lock / unlock / expire keys. As a particular case, I leave how to interpret the syntax when checking the status of the keys of each user. If we execute the line:

passwd -S User1

Returns a line similar to the following

User1 S dd / mm / yyyy f1 f2 f3 f4

This means:

User1 : account name
S: Key status. L locked P active and NP without key
dd / mm / yyyy: date of the last modification of the key
f1: minimum duration in days after modification
f2: maximum duration in days until the next modification.
f3: duration in days of the password change warning
f4: authorized duration in days of inactivity (-1 = infinite)

With passwd you have a simple way to manage your system keys from the console.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.