Home>Article>Operation and Maintenance> How to check if the user is locked in Linux
Method: 1. Execute "passwd -S daygeek" or "passwd --status daygeek". If the output information contains "LK", it means it is locked. 2. Execute "grep daygeek /etc/shadow". If there are two exclamation marks before the password, it is locked.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
Linux method to check whether the user is locked
Method 1: Use the passwd command
Pass The passwd command checks user account lockout status
# passwd -S daygeek 或 # passwd --status daygeek
This will output a brief message of the password status for a given account.
LK: The password is locked
NP: No password is set
PS: The password is locked Setup
Method 2: Use the grep daygeek /etc/shadow command
Use the /etc/shadow file to check the locked user account status. If the account is locked, two exclamation points will be added in front of the password.
Extended knowledge:
Use the -u switch to run the passwd command to unlock a given user account.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to check if the user is locked in Linux. For more information, please follow other related articles on the PHP Chinese website!