1PAM.CONF(5)                    Linux-PAM Manual                    PAM.CONF(5)


6       pam.conf, pam.d - PAM configuration files


9       When a PAM aware privilege granting application is started, it
10       activates its attachment to the PAM-API. This activation performs a
11       number of tasks, the most important being the reading of the
12       configuration file(s): /etc/pam.conf. Alternatively, this may be the
13       contents of the /etc/pam.d/ directory. The presence of this directory
14       will cause Linux-PAM to ignore /etc/pam.conf.
16       These files list the PAMs that will do the authentication tasks
17       required by this service, and the appropriate behavior of the PAM-API
18       in the event that individual PAMs fail.
20       The syntax of the /etc/pam.conf configuration file is as follows. The
21       file is made up of a list of rules, each rule is typically placed on a
22       single line, but may be extended with an escaped end of line: `\<LF>'.
23       Comments are preceded with `#' marks and extend to the next end of
24       line.
26       The format of each rule is a space separated collection of tokens, the
27       first three being case-insensitive:
29        service type control module-path module-arguments
31       The syntax of files contained in the /etc/pam.d/ directory, are
32       identical except for the absence of any service field. In this case,
33       the service is the name of the file in the /etc/pam.d/ directory. This
34       filename must be in lower case.
36       An important feature of PAM, is that a number of rules may be stacked
37       to combine the services of a number of PAMs for a given authentication
38       task.
40       The service is typically the familiar name of the corresponding
41       application: login and su are good examples. The service-name, other,
42       is reserved for giving default rules. Only lines that mention the
43       current service (or in the absence of such, the other entries) will be
44       associated with the given service-application.
46       The type is the management group that the rule corresponds to. It is
47       used to specify which of the management groups the subsequent module is
48       to be associated with. Valid entries are:
50       account
51           this module type performs non-authentication based account
52           management. It is typically used to restrict/permit access to a
53           service based on the time of day, currently available system
54           resources (maximum number of users) or perhaps the location of the
55           applicant user -- 'root' login only on the console.
57       auth
58           this module type provides two aspects of authenticating the user.
59           Firstly, it establishes that the user is who they claim to be, by
60           instructing the application to prompt the user for a password or
61           other means of identification. Secondly, the module can grant group
62           membership or other privileges through its credential granting
63           properties.
65       password
66           this module type is required for updating the authentication token
67           associated with the user. Typically, there is one module for each
68           'challenge/response' based authentication (auth) type.
70       session
71           this module type is associated with doing things that need to be
72           done for the user before/after they can be given service. Such
73           things include the logging of information concerning the
74           opening/closing of some data exchange with a user, mounting
75           directories, etc.
77       If the type value from the list above is prepended with a - character
78       the PAM library will not log to the system log if it is not possible to
79       load the module because it is missing in the system. This can be useful
80       especially for modules which are not always installed on the system and
81       are not required for correct authentication and authorization of the
82       login session.
84       The third field, control, indicates the behavior of the PAM-API should
85       the module fail to succeed in its authentication task. There are two
86       types of syntax for this control field: the simple one has a single
87       simple keyword; the more complicated one involves a square-bracketed
88       selection of value=action pairs.
90       For the simple (historical) syntax valid control values are:
92       required
93           failure of such a PAM will ultimately lead to the PAM-API returning
94           failure but only after the remaining stacked modules (for this
95           service and type) have been invoked.
97       requisite
98           like required, however, in the case that such a module returns a
99           failure, control is directly returned to the application or to the
100           superior PAM stack. The return value is that associated with the
101           first required or requisite module to fail. Note, this flag can be
102           used to protect against the possibility of a user getting the
103           opportunity to enter a password over an unsafe medium. It is
104           conceivable that such behavior might inform an attacker of valid
105           accounts on a system. This possibility should be weighed against
106           the not insignificant concerns of exposing a sensitive password in
107           a hostile environment.
109       sufficient
110           if such a module succeeds and no prior required module has failed
111           the PAM framework returns success to the application or to the
112           superior PAM stack immediately without calling any further modules
113           in the stack. A failure of a sufficient module is ignored and
114           processing of the PAM module stack continues unaffected.
116       optional
117           the success or failure of this module is only important if it is
118           the only module in the stack associated with this service+type.
120       include
121           include all lines of given type from the configuration file
122           specified as an argument to this control.
124       substack
125           include all lines of given type from the configuration file
126           specified as an argument to this control. This differs from include
127           in that evaluation of the done and die actions in a substack does
128           not cause skipping the rest of the complete module stack, but only
129           of the substack. Jumps in a substack also can not make evaluation
130           jump out of it, and the whole substack is counted as one module
131           when the jump is done in a parent stack. The reset action will
132           reset the state of a module stack to the state it was in as of
133           beginning of the substack evaluation.
135       For the more complicated syntax valid control values have the following
136       form:
138                 [value1=action1 value2=action2 ...]
141       Where valueN corresponds to the return code from the function invoked
142       in the module for which the line is defined. It is selected from one of
143       these: success, open_err, symbol_err, service_err, system_err, buf_err,
144       perm_denied, auth_err, cred_insufficient, authinfo_unavail,
145       user_unknown, maxtries, new_authtok_reqd, acct_expired, session_err,
146       cred_unavail, cred_expired, cred_err, no_module_data, conv_err,
147       authtok_err, authtok_recover_err, authtok_lock_busy,
148       authtok_disable_aging, try_again, ignore, abort, authtok_expired,
149       module_unknown, bad_item, conv_again, incomplete, and default.
151       The last of these, default, implies 'all valueN's not mentioned
152       explicitly. Note, the full list of PAM errors is available in
153       /usr/include/security/_pam_types.h. The actionN can take one of the
154       following forms:
156       ignore
157           when used with a stack of modules, the module's return status will
158           not contribute to the return code the application obtains.
160       bad
161           this action indicates that the return code should be thought of as
162           indicative of the module failing. If this module is the first in
163           the stack to fail, its status value will be used for that of the
164           whole stack.
166       die
167           equivalent to bad with the side effect of terminating the module
168           stack and PAM immediately returning to the application.
170       ok
171           this tells PAM that the administrator thinks this return code
172           should contribute directly to the return code of the full stack of
173           modules. In other words, if the former state of the stack would
174           lead to a return of PAM_SUCCESS, the module's return code will
175           override this value. Note, if the former state of the stack holds
176           some value that is indicative of a modules failure, this 'ok' value
177           will not be used to override that value.
179       done
180           equivalent to ok with the side effect of terminating the module
181           stack and PAM immediately returning to the application.
183       N (an unsigned integer)
184           equivalent to ok with the side effect of jumping over the next N
185           modules in the stack. Note that N equal to 0 is not allowed (and it
186           would be identical to ok in such case).
188       reset
189           clear all memory of the state of the module stack and start again
190           with the next stacked module.
192       Each of the four keywords: required; requisite; sufficient; and
193       optional, have an equivalent expression in terms of the [...] syntax.
194       They are as follows:
196       required
197           [success=ok new_authtok_reqd=ok ignore=ignore default=bad]
199       requisite
200           [success=ok new_authtok_reqd=ok ignore=ignore default=die]
202       sufficient
203           [success=done new_authtok_reqd=done default=ignore]
205       optional
206           [success=ok new_authtok_reqd=ok default=ignore]
208       module-path is either the full filename of the PAM to be used by the
209       application (it begins with a '/'), or a relative pathname from the
210       default module location: /lib/security/ or /lib64/security/, depending
211       on the architecture.
213       module-arguments are a space separated list of tokens that can be used
214       to modify the specific behavior of the given PAM. Such arguments will
215       be documented for each individual module. Note, if you wish to include
216       spaces in an argument, you should surround that argument with square
217       brackets.
219               squid auth required pam_mysql.so user=passwd_query passwd=mada \
220                     db=eminence [query=select user_name from internet_service \
221                     where user_name='%u' and password=PASSWORD('%p') and \
222                   service='web_proxy']
225       When using this convention, you can include `[' characters inside the
226       string, and if you wish to include a `]' character inside the string
227       that will survive the argument parsing, you should use `\]'. In other
228       words:
230               [..[..\]..]    -->   ..[..]..
233       Any line in (one of) the configuration file(s), that is not formatted
234       correctly, will generally tend (erring on the side of caution) to make
235       the authentication process fail. A corresponding error is written to
236       the system log files with a call to syslog(3).
238       More flexible than the single configuration file is it to configure
239       libpam via the contents of the /etc/pam.d/ directory. In this case the
240       directory is filled with files each of which has a filename equal to a
241       service-name (in lower-case): it is the personal configuration file for
242       the named service.
244       The syntax of each file in /etc/pam.d/ is similar to that of the
245       /etc/pam.conf file and is made up of lines of the following form:
247           type  control  module-path  module-arguments
250       The only difference being that the service-name is not present. The
251       service-name is of course the name of the given configuration file. For
252       example, /etc/pam.d/login contains the configuration for the login
253       service.


256       pam(3), PAM(8), pam_start(3)
260Linux-PAM Manual                  05/18/2017                       PAM.CONF(5)