The passwd command allows a user to change their password or to allow a superuser to change another user’s password.
Synopsis: passwd [option] [user]
Below is a list of the options that can be used with the passwd command. You can stack them, using more than one at a time.
|-k||The option -k is used to indicate that the update should only be for expired passwords.|
|-l||This option is used to lock the specified account. The command is only available for root users. The locking is performed by rendering the encrypted password into an invalid string (by prefixing the encrypted string with an !).|
|-u||This is the reverse of the -l (lock) option. It will unlock the account password by removing the ! prefix. This option is available to root only. Using the force option -f will override this protection.|
|-d||This is a quick way to delete a password for an account. It will set the named account passwordless. Available to root only.|
|-n||This will set the minimum password lifetime, in days, if the userâs account supports password lifetimes. Available to root only.|
|-x||This will set the maximum password lifetime, in days, if the userâs account supports password lifetimes. Available to root only.|
|-w||This will set the number of days in advance the user will begin receiving warnings that her password will expire, if the userâs account supports password lifetimes. Available to root only.|
|-i||This will set the number of days which will pass before an expired password for this account will be taken to mean that the account is inactive and should be disabled, if the userâs account supports password lifetimes. Available to root only.|
|-S||This will output a short information about the status of the password for a given account. Available to root user only.|
Changing password for user test1.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
passwd -l test1
Locking password for user test1.