I need to get the exact time and date at which a user account was locked or unlocked in Linux.

passwd -S command can give the status of an account i.e., if its locked or unlocked.

1 Answer 1


I don't thing it is possible. Locking the account work simply by altering the user password hash in /etc/shadow to unusable string - the time of the event is not stored anywhere.

-l, --lock This option is used to lock the password of specified account and it is available to root only. The locking is performed by rendering the encrypted password into an invalid string (by prefixing the encrypted string with an !). Note that the account is not fully locked - the user can still log in by other means of authenti‐cation such as the ssh public key authentication. Use chage -E 0 user command instead for full account locking.

My suggestion is to track the times of locking and unlocking some other way (e.g. custom shell script). It pretty much depends on how do you actualy use the locking.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.