Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Linux account locked after failed logins: read and reset pam_faillock

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

When pam_faillock has locked an account, even the correct password is refused until the lock ends. The user may see the message "The account is locked due to N failed logins." (N is the failure count; the Linux-PAM source adds "(10 minutes left to unlock)" style text while time remains), or only a plain denial when the silent option hides it. The Linux-PAM manual says the module "maintains a list of failed authentication attempts per user during a specified interval and locks the account in case there were more than deny consecutive failed authentications". The fix is to read that user's record with faillock --user NAME, work out what produced the failures, and then clear the record with faillock --user NAME --reset or let unlock_time run out.

What the symptom means

pam_faillock is a PAM module. It keeps one tally file per user in a tally directory, and the faillock command displays and clears those files (faillock(8)). pam_faillock(8) describes the preauth call, which sits before the modules that ask for the password: it "just examines whether the user should be blocked from accessing the service". For a successful password, the authsucc call clears the failure record "unless the user is already blocked due to previous authentication failures", and "Otherwise it will return authentication error". So a correct password does not help while the lock holds.

The user may see a message. In the Linux-PAM source at tag v1.7.1, the module prints "The account is locked due to %u failed logins." and, while time remains, "(%d minute left to unlock)" or "(%d minutes left to unlock)". It also logs "Consecutive login failures for user %s account temporarily locked" through syslog, unless the no_log_info option is set. faillock.conf(5) describes the silent option as "Don't print informative messages to the user", so a locked user may only see a plain denial.

The settings live in /etc/security/faillock.conf. The documented defaults (faillock.conf(5)):

Setting Meaning Default
deny=n Deny access if consecutive failures in the interval exceed n 3
fail_interval=n Seconds in which the failures must happen 900 (15 minutes)
unlock_time=n Seconds after the lock-out until access returns; 0 means never without a reset 600 (10 minutes)
dir=/path Where the tally files are kept /var/run/faillock
even_deny_root Root account can become locked as well as regular accounts No default stated; pam_faillock(8) says failed attempts to authenticate root normally do not block it

The arithmetic is 900 / 60 = 15 minutes and 600 / 60 = 10 minutes. The pam_faillock(8) example describes deny=4 as locking the account after 4 consecutive failed logins, while its description says "more than deny". Treat the exact count as something to test on your own system, not assume.

Likely causes

Cause What you see How to confirm
A person mistyping or using an old saved password Lock soon after a password change; the user knows when they tried faillock --user NAME shows recent failures at those times
A script, monitor or mount using a stale password Repeated locks every few minutes or hours Failure times follow a regular pattern
Brute-force attempts from the network Many locks across several users Failures on user names the real users do not use; the logs of the service show sources
Lock lasts after the reason ended unlock_time is long or 0 unlock_time in /etc/security/faillock.conf
Directory and central accounts both locking A user locked locally and in the central directory local_users_only in faillock.conf (see below)
Root locked Root refused at the console even_deny_root is set

Prove the cause before changing anything

All of the following only read. Use an account that is not locked, or the console. The faillock command normally needs root rights.

1. Show the record for the locked user.

faillock --user alice

faillock(8) says the command "can display the recent failed authentication attempts of the username". The manual does not describe the output columns, so look at the times of the failed attempts and compare them with when the user or a service tried to log in.

2. Read the settings. Open /etc/security/faillock.conf and note deny, fail_interval, unlock_time, dir, silent and even_deny_root. pam_faillock(8) says the module falls back to /usr/share/pam/security/faillock.conf if the first file does not exist, and that options on the PAM line override the file's values.

3. Find the source of the failures. The faillock manual pages describe failures recorded per user and do not mention a source address. Look in the logs of the service being used (for example your SSH daemon's log) around the recorded times. The Consecutive login failures line in the system log shows when the lock was applied.

4. Check whether another system also locks the user. If the account comes from a directory (AD, IdM, LDAP), faillock.conf(5) says local_users_only tracks only local users and prevents a double lockout "where a user is locked out locally and in the centralized mechanism".

A good result is a clear single source: a person, a named script, or an attack. A bad result is failures with no source you can name; keep the lock in place and investigate before you reset.

Fix

Reset one user

Disruptive step: a reset clears the failure count and allows more attempts at once. If the cause is an attack or a script that is still running, the user locks again, and you may have cleared the only record of the attempts. Save first: run faillock --user alice and keep its output in a text file as the record of what was cleared. Back out: there is none; a cleared record cannot be restored, so only clear after the record has been saved.

faillock --user alice --reset

faillock(8) describes --reset as: "Instead of displaying the user's failure records, clear them." It describes --user username as: "The user whose failure records should be displayed or cleared." Always give --user. faillock(8) says the command can "clear the tally files of all or individual usernames" and does not say what --reset does without --user. If the tally directory or configuration file is not the default, add --dir or --conf with the same values as your configuration.

Wait it out

Access returns unlock_time seconds after the lock-out. With the default of 600, that is 10 minutes. faillock.conf(5) adds that the default tally directory is "usually cleared on system boot", so access also returns after a reboot where /var/run/faillock is on memory-backed storage.

Remove the cause

Update the saved password in the script, mount or monitor that keeps failing, or tell the user to update the saved credential on the device. If the failures are an attack, deal with the source before you reset anyone. Changing deny or unlock_time only changes how fast the lock applies.

Change the policy

faillock.conf(5) notes that permanently locking users makes them "easily a target of denial of service attack". pam_faillock(8) says to configure options in /etc/security/faillock.conf and not on the module command line. The Linux-PAM manual pages document no command that checks faillock.conf for errors.

Risk: a wrong value can lock users out sooner than intended, or not lock at all. Save first: copy the file under a dated name, cp /etc/security/faillock.conf /etc/security/faillock.conf.20261120. Keep a root session open while you test with a test account. Back out: cp /etc/security/faillock.conf.20261120 /etc/security/faillock.conf, then test again with the test account.

Example (illustrative): On app01, the user alice gets "Permission denied" at the correct password. From a console as root, faillock --user alice lists several failed attempts, all within a few minutes of 09:00 and again at 09:15. A monitoring job on mon01 still uses alice's old password and runs every 15 minutes. The administrator saves the record, updates the job's password, then runs faillock --user alice --reset. alice logs in. Without the job change the account would have locked again within the next interval.

Confirm the fix

  1. faillock --user alice shows no recent failures after the reset.
  2. The user logs in with the correct password.
  3. After the next scheduled run of the script or job that caused the failures, the record stays clear.
  4. If you changed the policy, test it with a test account: a deliberate run of wrong passwords should lock it, and the lock should end after unlock_time.

What to watch afterwards

  • Watch the system log for the "Consecutive login failures" line and count locks per day.
  • When a password changes, update every script, mount and device that stores it.
  • Keep even_deny_root off unless you have console access that does not depend on the lock.
  • Decide whether unlock_time=0 fits your support model; it needs an administrator for every lock.

Risks and limits

  • These commands have not been run or lab-tested.
  • faillock(8) does not show the output format of faillock --user NAME.
  • The exact failed-attempt count that triggers the lock is described two ways in the manual; test it.
  • The message strings come from the Linux-PAM source at tag v1.7.1; your distribution's build may differ, and silent hides them.
  • The Linux-PAM manual pages do not say when faillock.conf, its fallback file /usr/share/pam/security/faillock.conf and the faillock tool were introduced. On an older or different build they may not exist as described, so compare the faillock command and the files on your own system with the defaults above before you rely on them.
  • How your distribution wires pam_faillock into its PAM stacks is distribution-specific and is not covered by the Linux-PAM manual pages.

Sources

  • faillock(8) — Linux-PAM manual, page date line 08/04/2026 (colophon: obtained 2026-08-04), accessed 20 November 2026
  • faillock.conf(5) — Linux-PAM manual, page date line 08/04/2026 (colophon: obtained 2026-08-04), accessed 20 November 2026
  • pam_faillock(8) — Linux-PAM manual, page date line 08/04/2026 (colophon: obtained 2026-08-04), accessed 20 November 2026
  • pam_faillock.c at tag v1.7.1 — Linux-PAM project source, tag v1.7.1, no date shown, accessed 20 November 2026