PAM_FAILLOCK(8)
๐ PAM_FAILLOCK(8) ๐
okay bestie, gather round, because this is pam_faillock from the Linux-PAM Manual and she is literally the bouncer of your login stack ๐โจ
โจ NAME โจ
pam_faillock โ a module that counts authentication failures during a specified interval ๐ฐ๏ธ๐
๐ธ SYNOPSIS ๐ธ
auth ... pam_faillock.so {preauth|authfail|authsucc}
[conf=/path/to/config-file]
[dir=/path/to/tally-directory] [even_deny_root]
[deny=n] [fail_interval=n] [unlock_time=n]
[root_unlock_time=n] [admin_group=name] [audit]
[silent] [no_log_info]
account ... pam_faillock.so [dir=/path/to/tally-directory] [no_log_info]
๐ฆ DESCRIPTION ๐ฆ
So what does she actually do? She keeps a lil list ๐ of failed authentication attempts per user during a specified interval, and if there were more than deny consecutive failed authentications, she locks the account. That's it. That's the whole vibe. no cap.
Now, plot twist: normally, failed attempts to authenticate root will not cause the root account to become blocked, and that's on purpose โ it prevents denial-of-service ๐
โโ๏ธ. The logic being: if your users aren't given shell accounts, and root may only login via su or at the machine console (not telnet/rsh, etc), then this is safe. โจ
๐ OPTIONS ๐
{preauth|authfail|authsucc}โ this argument has to be set to match wherever this module instance sits in the PAM stack. You don't get to freestyle it, bestie, it's giving positional.- The
preauthargument must be used when the module is called before the modules which ask for the user credentials, like the password. In this mode the module just peeks ๐ at whether the user should be blocked from accessing the service, in case there were an anomalous number of failed consecutive authentication attempts recently. This call is optional ifauthsuccis used. - The
authfailargument must be used when the module is called after the modules which determine the authentication outcome, and that outcome was failed. Unless the user is already blocked due to previous authentication failures, the module will record the failure into the appropriate user tally file. ๐๏ธ - The
authsuccargument must be used when the module is called after the modules which determine the authentication outcome, and that outcome succeeded. Unless the user is already blocked due to previous authentication failures, the module will then clear the record of the failures in the respective user tally file. Otherwise it will return authentication error ๐ญ. If this call is not done,pam_faillockwill not distinguish between consecutive and non-consecutive failed authentication attempts. Thepreauthcall must be used in such case. And because the PAM stack can be configured in complicated ways, it is also possible to callpam_faillockas anaccountmodule. In such a configuration the module must be also called in thepreauthstage. (iykyk)
- The
conf=/path/to/config-fileโ use another configuration file instead of the default/etc/security/faillock.conf๐
The options for configuring the module behavior are described in the faillock.conf(5) manual page. The options specified on the module command line override the values from the configuration file. ๐ฅ
๐ MODULE TYPES PROVIDED ๐
The auth and account module types are provided. just the two. iconic behavior.
โญ RETURN VALUES โญ
PAM_AUTH_ERRโ an invalid option was given, the module was not able to retrieve the user name, no valid counter file was found, or too many failed logins. ๐PAM_BUF_ERRโ memory buffer error.PAM_CONV_ERRโ the conversation method supplied by the application failed to obtain the username.PAM_INCOMPLETEโ the conversation method supplied by the application returnedPAM_CONV_AGAIN.PAM_SUCCESSโ everything was successful. slay ๐PAM_IGNOREโ user not present in passwd database.
๐ NOTES ๐
Configuring options on the module command line is not recommend. The /etc/security/faillock.conf should be used instead. (yes bestie, the original says "recommend", we keep it exactly like that, we don't edit the ancestors)
The setup of pam_faillock in the PAM stack is different from the pam_tally2 module setup. ๐
Individual files with the failure records are created as owned by the user. This allows pam_faillock.so module to work correctly when it is called from a screensaver. ๐ฅ๏ธโจ
Note that using the module in preauth without the silent option specified in /etc/security/faillock.conf or with requisite control field leaks an information about existence or non-existence of a user account in the system, because the failures are not recorded for the unknown users. The message about the user account being locked is never displayed for non-existing user accounts, allowing the adversary to infer that a particular account is not existing on a system. ๐ต๏ธโโ๏ธ so likeโฆ be careful, that's a whole information leak vibe.
If the auth stack has not been run prior to the account stack, the logic to reset the failed login counter is intentionally skipped. This prevents automated services, such as crond or systemd-user, which might only perform account management tasks, from inadvertently clearing a user's failed attempt records. This ensures the faillock counter is only reset by a service that performs a full, successful authentication. ๐
๐ EXAMPLES ๐
Here are two possible configuration examples for /etc/pam.d/login. They make pam_faillock lock the account after 4 consecutive failed logins during the default interval of 15 minutes. Root account will be locked as well. The accounts will be automatically unlocked after 20 minutes. ๐
In the first example the module is called only in the auth phase and the module does not print any information about the account being blocked by pam_faillock. The preauth call can be added to tell users that their logins are blocked by the module and also to abort the authentication without even asking for password in such case. ๐ซ๐
/etc/security/faillock.conf file example:
deny=4
unlock_time=1200
silent
/etc/pam.d/config file example:
auth required pam_securetty.so
auth required pam_env.so
auth required pam_nologin.so
# optionally call: auth requisite pam_faillock.so preauth
# to display the message about account being locked
auth [success=1 default=bad] pam_unix.so
auth [default=die] pam_faillock.so authfail
auth sufficient pam_faillock.so authsucc
auth required pam_deny.so
account required pam_unix.so
password required pam_unix.so shadow
session required pam_selinux.so close
session required pam_loginuid.so
session required pam_unix.so
session required pam_selinux.so open
In the second example the module is called both in the auth and account phases, and the module informs the authenticating user when the account is locked if silent option is not specified in the faillock.conf. ๐ข
auth required pam_securetty.so
auth required pam_env.so
auth required pam_nologin.so
auth required pam_faillock.so preauth
# optionally use requisite above if you do not want to prompt for the password
# on locked accounts
auth sufficient pam_unix.so
auth [default=die] pam_faillock.so authfail
auth required pam_deny.so
account required pam_faillock.so
# if you drop the above call to pam_faillock.so the lock will be done also
# on non-consecutive authentication failures
account required pam_unix.so
password required pam_unix.so shadow
session required pam_selinux.so close
session required pam_loginuid.so
session required pam_unix.so
session required pam_selinux.so open
๐ง FILES ๐ง
/var/run/faillock/*โ the files logging the authentication failures for users ๐๏ธ- Note: These files will disappear after reboot on systems configured with directory
/var/run/faillockmounted on virtual memory. For persistent storage use the optiondir=in file/etc/security/faillock.conf. ๐พ (do NOT get caught lacking, bestie)
- Note: These files will disappear after reboot on systems configured with directory
/etc/security/faillock.confโ the config file forpam_faillockoptions ๐
๐ซถ SEE ALSO ๐ซถ
faillock(8), faillock.conf(5), pam.conf(5), pam.d(5), pam(8)
๐ AUTHOR ๐
pam_faillock was written by Tomas Mraz. thank you king ๐ซกโจ
and that's the whole page, bestie ๐ this version came out of [FIXME: source] on 09/27/2026 โ yeah the source tag is literally still a FIXME and we're keeping it exactly as is, no notes, it's giving mysterious ๐ธ mwah, go lock some accounts responsibly โจ๐
๐ฆ where this page comes from
- arch rolling: pam 1.7.3-1 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms