1 <?xml version="1.0" encoding='UTF-8'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
5 <refentry id="pam_tally">
8 <refentrytitle>pam_tally</refentrytitle>
9 <manvolnum>8</manvolnum>
10 <refmiscinfo class="sectdesc">Linux-PAM Manual</refmiscinfo>
13 <refnamediv id="pam_tally-name">
14 <refname>pam_tally</refname>
15 <refpurpose>The login counter (tallying) module</refpurpose>
19 <cmdsynopsis id="pam_tally-cmdsynopsis1">
20 <command>pam_tally.so</command>
22 file=<replaceable>/path/to/counter</replaceable>
25 onerr=[<replaceable>fail</replaceable>|<replaceable>succeed</replaceable>]
31 even_deny_root_account
34 deny=<replaceable>n</replaceable>
37 lock_time=<replaceable>n</replaceable>
40 unlock_time=<replaceable>n</replaceable>
61 <cmdsynopsis id="pam_tally-cmdsynopsis2">
62 <command>pam_tally</command>
64 --file <replaceable>/path/to/counter</replaceable>
67 --user <replaceable>username</replaceable>
70 --reset[=<replaceable>n</replaceable>]
78 <refsect1 id="pam_tally-description">
80 <title>DESCRIPTION</title>
83 This module maintains a count of attempted accesses, can
84 reset count on success, can deny access if too many attempts
88 pam_tally has several limitations, which are solved with
89 pam_tally2. For this reason pam_tally is deprecated and
90 will be removed in a future release.
93 pam_tally comes in two parts:
94 <emphasis remap='B'>pam_tally.so</emphasis> and
95 <command>pam_tally</command>. The former is the PAM module and
96 the latter, a stand-alone program. <command>pam_tally</command>
97 is an (optional) application which can be used to interrogate and
98 manipulate the counter file. It can display users' counts, set
99 individual counts, or clear all counts. Setting artificially high
100 counts may be useful for blocking users without changing their
101 passwords. For example, one might find it useful to clear all counts
102 every midnight from a cron job. The
104 <refentrytitle>faillog</refentrytitle><manvolnum>8</manvolnum>
105 </citerefentry> command can be used instead of pam_tally to to
106 maintain the counter file.
109 Normally, failed attempts to access <emphasis>root</emphasis> will
110 <emphasis remap='B'>not</emphasis> cause the root account to become
111 blocked, to prevent denial-of-service: if your users aren't given
112 shell accounts and root may only login via <command>su</command> or
113 at the machine console (not telnet/rsh, etc), this is safe.
117 <refsect1 id="pam_tally-options">
119 <title>OPTIONS</title>
127 This can be used for <emphasis>auth</emphasis> and
128 <emphasis>account</emphasis> module types.
133 <option>onerr=[<replaceable>fail</replaceable>|<replaceable>succeed</replaceable>]</option>
137 If something weird happens (like unable to open the file),
138 return with <errorcode>PAM_SUCCESS</errorcode> if
139 <option>onerr=<replaceable>succeed</replaceable></option>
140 is given, else with the corresponding PAM error code.
146 <option>file=<replaceable>/path/to/counter</replaceable></option>
150 File where to keep counts. Default is
151 <filename>/var/log/faillog</filename>.
157 <option>audit</option>
161 Will log the user name into the system log if the user is not found.
167 <option>silent</option>
171 Don't print informative messages.
177 <option>no_log_info</option>
181 Don't log informative messages via <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
195 Authentication phase first checks if user should be denied
196 access and if not it increments attempted login counter. Then
197 on call to <citerefentry>
198 <refentrytitle>pam_setcred</refentrytitle><manvolnum>3</manvolnum>
199 </citerefentry> it resets the attempts counter.
204 <option>deny=<replaceable>n</replaceable></option>
208 Deny access if tally for this user exceeds
209 <replaceable>n</replaceable>.
215 <option>lock_time=<replaceable>n</replaceable></option>
219 Always deny for <replaceable>n</replaceable> seconds
220 after failed attempt.
226 <option>unlock_time=<replaceable>n</replaceable></option>
230 Allow access after <replaceable>n</replaceable> seconds
231 after failed attempt. If this option is used the user will
232 be locked out for the specified amount of time after he
233 exceeded his maximum allowed attempts. Otherwise the
234 account is locked until the lock is removed by a manual
235 intervention of the system administrator.
241 <option>magic_root</option>
245 If the module is invoked by a user with uid=0 the
246 counter is not incremented. The sysadmin should use this
247 for user launched services, like <command>su</command>,
248 otherwise this argument should be omitted.
254 <option>no_lock_time</option>
258 Do not use the .fail_locktime field in
259 <filename>/var/log/faillog</filename> for this user.
265 <option>no_reset</option>
269 Don't reset count on successful entry, only decrement.
275 <option>even_deny_root_account</option>
279 Root account can become unavailable.
285 <option>per_user</option>
289 If <filename>/var/log/faillog</filename> contains a non-zero
290 .fail_max/.fail_locktime field for this user then use it
291 instead of <option>deny=<replaceable>n</replaceable></option>/
292 <option>lock_time=<replaceable>n</replaceable></option> parameter.
298 <option>no_lock_time</option>
302 Don't use .fail_locktime filed in
303 <filename>/var/log/faillog</filename> for this user.
319 Account phase resets attempts counter if the user is
320 <emphasis remap='B'>not</emphasis> magic root.
321 This phase can be used optionally for services which don't call
323 <refentrytitle>pam_setcred</refentrytitle><manvolnum>3</manvolnum>
324 </citerefentry> correctly or if the reset should be done regardless
325 of the failure of the account phase of other modules.
330 <option>magic_root</option>
334 If the module is invoked by a user with uid=0 the
335 counter is not incremented. The sysadmin should use this
336 for user launched services, like <command>su</command>,
337 otherwise this argument should be omitted.
343 <option>no_reset</option>
347 Don't reset count on successful entry, only decrement.
357 <refsect1 id="pam_tally-types">
358 <title>MODULE TYPES PROVIDED</title>
360 The <option>auth</option> and <option>account</option>
361 module types are provided.
365 <refsect1 id='pam_tally-return_values'>
366 <title>RETURN VALUES</title>
369 <term>PAM_AUTH_ERR</term>
372 A invalid option was given, the module was not able
373 to retrieve the user name, no valid counter file
374 was found, or too many failed logins.
379 <term>PAM_SUCCESS</term>
382 Everything was successful.
387 <term>PAM_USER_UNKNOWN</term>
397 <refsect1 id='pam_tally-examples'>
398 <title>EXAMPLES</title>
400 Add the following line to <filename>/etc/pam.d/login</filename> to
401 lock the account after too many failed logins. The number of
402 allowed fails is specified by <filename>/var/log/faillog</filename>
403 and needs to be set with pam_tally or <citerefentry>
404 <refentrytitle>faillog</refentrytitle><manvolnum>8</manvolnum>
405 </citerefentry> before.
408 auth required pam_securetty.so
409 auth required pam_tally.so per_user
410 auth required pam_env.so
411 auth required pam_unix.so
412 auth required pam_nologin.so
413 account required pam_unix.so
414 password required pam_unix.so
415 session required pam_limits.so
416 session required pam_unix.so
417 session required pam_lastlog.so nowtmp
418 session optional pam_mail.so standard
422 <refsect1 id="pam_tally-files">
426 <term><filename>/var/log/faillog</filename></term>
428 <para>failure logging file</para>
434 <refsect1 id='pam_tally-see_also'>
435 <title>SEE ALSO</title>
438 <refentrytitle>faillog</refentrytitle><manvolnum>8</manvolnum>
441 <refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum>
444 <refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum>
447 <refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum>
452 <refsect1 id='pam_tally-author'>
453 <title>AUTHOR</title>
455 pam_tally was written by Tim Baverstock and Tomas Mraz.