1. Check user account password status
To check the status of existing Linux account present in /etc/passwd /etc/shadow
# passwd -S user_name
user_name PS 2023-04-28 0 90 7 -1 (Password set, SHA512 crypt.)
Lock local user wth chage command
# chage -l user_name
Last password change : Feb 10, 2023
Password expires : May 11, 2023
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 90
Number of days of warning before password expires : 7
2. Unlock user with local tools usermod / passwd / chage cmds
– unlock user with usermod
# usermod -U user_name
– unlock user with passwd
# passwd -u user_name
– (remove completely expiry date)
# chage -E -1 user_name
– howto set specific expiry date
# usermod -U –expiredate ' ' user_name
3. Lock account (expire the local user account) of a local system user account
If you have some user that you don’t need to have accessibility to the Linux machines anymore
# usermod -L user_name
# passwd -l user_name
To set existing non-expired user account to expiry with chage command exec:
# chage -E0 user_name
Set user that is no longer supposed to use his account to nologin at all
# usermod -s /sbin/nologin
More helpful Articles
Tags: Account, chage, change, check, command, etc passwd, How to, maximum number, password, username