I occasionally find myself in a situation where an undermaintained system has an account that's been locked out. The problem is that there are a variety of ways in which an account can be locked out, each with their own method of being unlocked.
It's not that the account is being locked improperly, just unexpectedly, but finding the correct lock to reset is difficult.
My most recent attack of this problem was on a SUSE system, and it turned out that the password had expired (which wasn't initially known because the login attempts were not through a system that provided that sort of feedback), and then also locked due to failed login attempts.
Is there a list somewhere of all of the different possible account locks and how to disable them? I'm intending for actual brokenness, such as home directory access problems, corrupt PAM libraries, etc., to be out of scope for this question.
You can use
passwd
to gather some information e.g. if an account is lockedThe
chage
utility will provide information about the various timers on an account e.g. for an unexpired passwordfor an expired password
The
passwd
andchage
utilities also list many of the account locks.You can use
getent
to pull the information directly from the relevant database for examinationIn general: no.
Iain's answer is a good summary of how to query the password aging systems, but missed out all sorts of things. For example:
sshd
configuration.PAM
configuration may require explicit group membership to log in, or may only permit a particular list of users./etc/nologin
, which for some applications (e.g.,ssh
) will lock out all users.In other words, there are many ways for an account to be locked out that have nothing to do with the
passwd
file. Your best bet is to check/var/log/secure
or the distribution-appropriate local analog.In addition to the aforementioned,
passwd
chage
andgetent
, there's alsopam_tally2
If the number of failed login attempts is above the allowable limit (which is set in /etc/pam.d/password-auth), you'll have to do
pam_tally2 --user=foo --reset
before they can login again.Following script would give you a short description of all users and their status (locked or not)