To check the lock status of a user account in Linux, you can use the passwd command with the -S option. For example:
# passwd -S user user P 08/03/2022 -1
The -S option displays the current status of the specified user’s password, including whether the account is locked or unlocked. In the output above, the P indicates that the user’s password is locked.
You can also use the usermod command to check the lock status of a user account. For example:
# usermod -L user
This command will show you whether the user account is locked or not, without modifying the account’s lock status.
If you want to lock or unlock a user account, you can use the usermod command with the -L or -U options, respectively. For example:
# usermod -L user # lock the user account # usermod -U user # unlock the user account
Keep in mind that you will need to be logged in as the root user, or use sudo, to perform these actions.