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