To manage Linux users with the passwd command is very handy and straight forward. After brewing a really good Colombian coffee at home from Finca La Camelia I decided to put this brief tutorial.

passwd command options

passwd -S <username>

This option displays the status of a specific user. Example output:

username PS 2022-06-13 0 99999 7 -1 (Password set, SHA512 crypt.)

In the above example it shows that username was created June 13, 2022 with a SHA512 encryption.

passwd -l <username>

The above option with -l will lock the username above. This only locks access to the system, but the user can still login if he/she has SSH access set with a public key.

passwd -u <username>

With the -u option above you will ‘unlock’ the username that was already in ‘locked’ state with the -l option.

passwd -d <username>

The above will delete a password for username.

passwd -e <username>

To expire an account immediately use the above option -e. This option will force username to change their password at next login.

passwd -n 10 username

The above indicates the username cannot change their password until 10 days have gone by.

passwd -x 90 username

The above tells the Linux system that username that after 90 days the password will expire forcing the username to change their password.

Hopefully this short tutorial can point you to the right direction. You can always contact me if you have any questions. Also, check out my shop for unique coffee mugs and t-shirt designs I created. There are more options to manage Linux passwd command, but these are the most common ones. I will be adding more options soon.

Leave a comment

Your email address will not be published.