1PAM.CONF(5) Linux-PAM Manual PAM.CONF(5)
2
3
4
6 pam.conf, pam.d - PAM configuration files
7
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.
15
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.
19
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.
25
26 The format of each rule is a space separated collection of tokens, the
27 first three being case-insensitive:
28
29 service type control module-path module-arguments
30
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.
35
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.
39
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.
45
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:
49
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.
56
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.
64
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.
69
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.
76
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.
83
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.
89
90 For the simple (historical) syntax valid control values are:
91
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.
96
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.
108
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.
115
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.
119
120 include
121 include all lines of given type from the configuration file
122 specified as an argument to this control.
123
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.
134
135 For the more complicated syntax valid control values have the following
136 form:
137
138 [value1=action1 value2=action2 ...]
139
140
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.
150
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:
155
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.
159
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. This is the default action for all return codes.
165
166 die
167 equivalent to bad with the side effect of terminating the module
168 stack and PAM immediately returning to the application.
169
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.
178
179 done
180 equivalent to ok with the side effect of terminating the module
181 stack and PAM immediately returning to the application unless there
182 was a non-ignored module failure before.
183
184 N (an unsigned integer)
185 jump over the next N modules in the stack. Note that N equal to 0
186 is not allowed, it would be treated as ignore in such case. The
187 side effect depends on the PAM function call: for pam_authenticate,
188 pam_acct_mgmt, pam_chauthtok, and pam_open_session it is ignore;
189 for pam_setcred and pam_close_session it is one of ignore, ok, or
190 bad depending on the module's return value.
191
192 reset
193 clear all memory of the state of the module stack and start again
194 with the next stacked module.
195
196 If a return code's action is not specifically defined via a valueN
197 token, and the default value is not specified, that return code's
198 action defaults to bad.
199
200 Each of the four keywords: required; requisite; sufficient; and
201 optional, have an equivalent expression in terms of the [...] syntax.
202 They are as follows:
203
204 required
205 [success=ok new_authtok_reqd=ok ignore=ignore default=bad]
206
207 requisite
208 [success=ok new_authtok_reqd=ok ignore=ignore default=die]
209
210 sufficient
211 [success=done new_authtok_reqd=done default=ignore]
212
213 optional
214 [success=ok new_authtok_reqd=ok default=ignore]
215
216 module-path is either the full filename of the PAM to be used by the
217 application (it begins with a '/'), or a relative pathname from the
218 default module location: /lib/security/ or /lib64/security/, depending
219 on the architecture.
220
221 module-arguments are a space separated list of tokens that can be used
222 to modify the specific behavior of the given PAM. Such arguments will
223 be documented for each individual module. Note, if you wish to include
224 spaces in an argument, you should surround that argument with square
225 brackets.
226
227 squid auth required pam_mysql.so user=passwd_query passwd=mada \
228 db=eminence [query=select user_name from internet_service \
229 where user_name='%u' and password=PASSWORD('%p') and \
230 service='web_proxy']
231
232
233 When using this convention, you can include `[' characters inside the
234 string, and if you wish to include a `]' character inside the string
235 that will survive the argument parsing, you should use `\]'. In other
236 words:
237
238 [..[..\]..] --> ..[..]..
239
240
241 Any line in (one of) the configuration file(s), that is not formatted
242 correctly, will generally tend (erring on the side of caution) to make
243 the authentication process fail. A corresponding error is written to
244 the system log files with a call to syslog(3).
245
246 More flexible than the single configuration file is it to configure
247 libpam via the contents of the /etc/pam.d/ directory. In this case the
248 directory is filled with files each of which has a filename equal to a
249 service-name (in lower-case): it is the personal configuration file for
250 the named service.
251
252 The syntax of each file in /etc/pam.d/ is similar to that of the
253 /etc/pam.conf file and is made up of lines of the following form:
254
255 type control module-path module-arguments
256
257
258 The only difference being that the service-name is not present. The
259 service-name is of course the name of the given configuration file. For
260 example, /etc/pam.d/login contains the configuration for the login
261 service.
262
264 pam(3), PAM(8), pam_start(3)
265
266
267
268Linux-PAM Manual 09/03/2021 PAM.CONF(5)