| 1 |
'\" t |
| 2 |
.\" Title: pam.conf |
| 3 |
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] |
| 4 |
.\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/> |
| 5 |
.\" Date: 06/29/2025 |
| 6 |
.\" Manual: Linux-PAM Manual |
| 7 |
.\" Source: Linux-PAM |
| 8 |
.\" Language: English |
| 9 |
.\" |
| 10 |
.TH "PAM\&.CONF" "5" "06/29/2025" "Linux\-PAM" "Linux\-PAM Manual" |
| 11 |
.\" ----------------------------------------------------------------- |
| 12 |
.\" * Define some portability stuff |
| 13 |
.\" ----------------------------------------------------------------- |
| 14 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 |
.\" http://bugs.debian.org/507673 |
| 16 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 17 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 18 |
.ie \n(.g .ds Aq \(aq |
| 19 |
.el .ds Aq ' |
| 20 |
.\" ----------------------------------------------------------------- |
| 21 |
.\" * set default formatting |
| 22 |
.\" ----------------------------------------------------------------- |
| 23 |
.\" disable hyphenation |
| 24 |
.nh |
| 25 |
.\" disable justification (adjust text to left margin only) |
| 26 |
.ad l |
| 27 |
.\" ----------------------------------------------------------------- |
| 28 |
.\" * MAIN CONTENT STARTS HERE * |
| 29 |
.\" ----------------------------------------------------------------- |
| 30 |
.SH "NAME" |
| 31 |
pam.conf, pam.d \- PAM configuration files |
| 32 |
.SH "DESCRIPTION" |
| 33 |
.PP |
| 34 |
When a |
| 35 |
\fIPAM\fR |
| 36 |
aware privilege granting application is started, it activates its attachment to the PAM\-API\&. This activation performs a number of tasks, the most important being the reading of the configuration file(s): |
| 37 |
/etc/pam\&.conf\&. Alternatively and preferably, the configuration can be set by individual configuration files located in a |
| 38 |
pam\&.d |
| 39 |
directory\&. The presence of this directory will cause |
| 40 |
\fBLinux\-PAM\fR |
| 41 |
to |
| 42 |
\fIignore\fR |
| 43 |
/etc/pam\&.conf\&. |
| 44 |
.PP |
| 45 |
These files list the |
| 46 |
\fIPAM\fRs that will do the authentication tasks required by this service, and the appropriate behavior of the PAM\-API in the event that individual |
| 47 |
\fIPAM\fRs fail\&. |
| 48 |
.PP |
| 49 |
The syntax of the |
| 50 |
/etc/pam\&.conf |
| 51 |
configuration file is as follows\&. The file is made up of a list of rules, each rule is typically placed on a single line, but may be extended with an escaped end of line: `\e<LF>\*(Aq\&. Comments are preceded with `#\*(Aq marks and extend to the next end of line\&. |
| 52 |
.PP |
| 53 |
The format of each rule is a space separated collection of tokens, the first three being case\-insensitive: |
| 54 |
.PP |
| 55 |
\fB service type control module\-path module\-arguments\fR |
| 56 |
.PP |
| 57 |
The syntax of files contained in the |
| 58 |
/etc/pam\&.d/ |
| 59 |
directory, are identical except for the absence of any |
| 60 |
\fIservice\fR |
| 61 |
field\&. In this case, the |
| 62 |
\fIservice\fR |
| 63 |
is the name of the file in the |
| 64 |
/etc/pam\&.d/ |
| 65 |
directory\&. This filename must be in lower case\&. |
| 66 |
.PP |
| 67 |
An important feature of |
| 68 |
\fIPAM\fR, is that a number of rules may be |
| 69 |
\fIstacked\fR |
| 70 |
to combine the services of a number of PAMs for a given authentication task\&. |
| 71 |
.PP |
| 72 |
The |
| 73 |
\fIservice\fR |
| 74 |
is typically the familiar name of the corresponding application: |
| 75 |
\fIlogin\fR |
| 76 |
and |
| 77 |
\fIsu\fR |
| 78 |
are good examples\&. The |
| 79 |
\fIservice\fR\-name, |
| 80 |
\fIother\fR, is reserved for giving |
| 81 |
\fIdefault\fR |
| 82 |
rules\&. Only lines that mention the current service (or in the absence of such, the |
| 83 |
\fIother\fR |
| 84 |
entries) will be associated with the given service\-application\&. |
| 85 |
.PP |
| 86 |
The |
| 87 |
\fItype\fR |
| 88 |
is the management group that the rule corresponds to\&. It is used to specify which of the management groups the subsequent module is to be associated with\&. Valid entries are: |
| 89 |
.PP |
| 90 |
account |
| 91 |
.RS 4 |
| 92 |
this module type performs non\-authentication based account management\&. It is typically used to restrict/permit access to a service based on the time of day, currently available system resources (maximum number of users) or perhaps the location of the applicant user \-\- \*(Aqroot\*(Aq login only on the console\&. |
| 93 |
.RE |
| 94 |
.PP |
| 95 |
auth |
| 96 |
.RS 4 |
| 97 |
this module type provides two aspects of authenticating the user\&. Firstly, it establishes that the user is who they claim to be, by instructing the application to prompt the user for a password or other means of identification\&. Secondly, the module can grant group membership or other privileges through its credential granting properties\&. |
| 98 |
.RE |
| 99 |
.PP |
| 100 |
password |
| 101 |
.RS 4 |
| 102 |
this module type is required for updating the authentication token associated with the user\&. Typically, there is one module for each \*(Aqchallenge/response\*(Aq based authentication (auth) type\&. |
| 103 |
.RE |
| 104 |
.PP |
| 105 |
session |
| 106 |
.RS 4 |
| 107 |
this module type is associated with doing things that need to be done for the user before/after they can be given service\&. Such things include the logging of information concerning the opening/closing of some data exchange with a user, mounting directories, etc\&. |
| 108 |
.RE |
| 109 |
.PP |
| 110 |
If the |
| 111 |
\fItype\fR |
| 112 |
value from the list above is prepended with a |
| 113 |
\fI\-\fR |
| 114 |
character the PAM library will not log to the system log if it is not possible to load the module because it is missing in the system\&. This can be useful especially for modules which are not always installed on the system and are not required for correct authentication and authorization of the login session\&. |
| 115 |
.PP |
| 116 |
The third field, |
| 117 |
\fIcontrol\fR, indicates the behavior of the PAM\-API should the module fail to succeed in its authentication task\&. There are two types of syntax for this control field: the simple one has a single simple keyword; the more complicated one involves a square\-bracketed selection of |
| 118 |
\fIvalue=action\fR |
| 119 |
pairs\&. |
| 120 |
.PP |
| 121 |
For the simple (historical) syntax valid |
| 122 |
\fIcontrol\fR |
| 123 |
values are: |
| 124 |
.PP |
| 125 |
required |
| 126 |
.RS 4 |
| 127 |
failure of such a PAM will ultimately lead to the PAM\-API returning failure but only after the remaining |
| 128 |
\fIstacked\fR |
| 129 |
modules (for this |
| 130 |
\fIservice\fR |
| 131 |
and |
| 132 |
\fItype\fR) have been invoked\&. |
| 133 |
.RE |
| 134 |
.PP |
| 135 |
requisite |
| 136 |
.RS 4 |
| 137 |
like |
| 138 |
\fIrequired\fR, however, in the case that such a module returns a failure, control is directly returned to the application or to the superior PAM stack\&. The return value is that associated with the first required or requisite module to fail\&. Note, this flag can be used to protect against the possibility of a user getting the opportunity to enter a password over an unsafe medium\&. It is conceivable that such behavior might inform an attacker of valid accounts on a system\&. This possibility should be weighed against the not insignificant concerns of exposing a sensitive password in a hostile environment\&. |
| 139 |
.RE |
| 140 |
.PP |
| 141 |
sufficient |
| 142 |
.RS 4 |
| 143 |
if such a module succeeds and no prior |
| 144 |
\fIrequired\fR |
| 145 |
module has failed the PAM framework returns success to the application or to the superior PAM stack immediately without calling any further modules in the stack\&. A failure of a |
| 146 |
\fIsufficient\fR |
| 147 |
module is ignored and processing of the PAM module stack continues unaffected\&. |
| 148 |
.RE |
| 149 |
.PP |
| 150 |
optional |
| 151 |
.RS 4 |
| 152 |
the success or failure of this module is only important if it is the only module in the stack associated with this |
| 153 |
\fIservice\fR+\fItype\fR\&. |
| 154 |
.RE |
| 155 |
.PP |
| 156 |
include |
| 157 |
.RS 4 |
| 158 |
include all lines of given type from the configuration file specified as an argument to this control\&. |
| 159 |
.RE |
| 160 |
.PP |
| 161 |
substack |
| 162 |
.RS 4 |
| 163 |
include all lines of given type from the configuration file specified as an argument to this control\&. This differs from |
| 164 |
\fIinclude\fR |
| 165 |
in that evaluation of the |
| 166 |
\fIdone\fR |
| 167 |
and |
| 168 |
\fIdie\fR |
| 169 |
actions in a substack does not cause skipping the rest of the complete module stack, but only of the substack\&. Jumps in a substack also can not make evaluation jump out of it, and the whole substack is counted as one module when the jump is done in a parent stack\&. The |
| 170 |
\fIreset\fR |
| 171 |
action will reset the state of a module stack to the state it was in as of beginning of the substack evaluation\&. |
| 172 |
.RE |
| 173 |
.PP |
| 174 |
For the more complicated syntax valid |
| 175 |
\fIcontrol\fR |
| 176 |
values have the following form: |
| 177 |
.sp |
| 178 |
.if n \{\ |
| 179 |
.RS 4 |
| 180 |
.\} |
| 181 |
.nf |
| 182 |
[value1=action1 value2=action2 \&.\&.\&.] |
| 183 |
|
| 184 |
.fi |
| 185 |
.if n \{\ |
| 186 |
.RE |
| 187 |
.\} |
| 188 |
.PP |
| 189 |
Where |
| 190 |
\fIvalueN\fR |
| 191 |
corresponds to the return code from the function invoked in the module for which the line is defined\&. It is selected from one of these: |
| 192 |
\fIsuccess\fR, |
| 193 |
\fIopen_err\fR, |
| 194 |
\fIsymbol_err\fR, |
| 195 |
\fIservice_err\fR, |
| 196 |
\fIsystem_err\fR, |
| 197 |
\fIbuf_err\fR, |
| 198 |
\fIperm_denied\fR, |
| 199 |
\fIauth_err\fR, |
| 200 |
\fIcred_insufficient\fR, |
| 201 |
\fIauthinfo_unavail\fR, |
| 202 |
\fIuser_unknown\fR, |
| 203 |
\fImaxtries\fR, |
| 204 |
\fInew_authtok_reqd\fR, |
| 205 |
\fIacct_expired\fR, |
| 206 |
\fIsession_err\fR, |
| 207 |
\fIcred_unavail\fR, |
| 208 |
\fIcred_expired\fR, |
| 209 |
\fIcred_err\fR, |
| 210 |
\fIno_module_data\fR, |
| 211 |
\fIconv_err\fR, |
| 212 |
\fIauthtok_err\fR, |
| 213 |
\fIauthtok_recover_err\fR, |
| 214 |
\fIauthtok_lock_busy\fR, |
| 215 |
\fIauthtok_disable_aging\fR, |
| 216 |
\fItry_again\fR, |
| 217 |
\fIignore\fR, |
| 218 |
\fIabort\fR, |
| 219 |
\fIauthtok_expired\fR, |
| 220 |
\fImodule_unknown\fR, |
| 221 |
\fIbad_item\fR, |
| 222 |
\fIconv_again\fR, |
| 223 |
\fIincomplete\fR, and |
| 224 |
\fIdefault\fR\&. |
| 225 |
.PP |
| 226 |
The last of these, |
| 227 |
\fIdefault\fR, implies \*(Aqall |
| 228 |
\fIvalueN\fR\*(Aqs not mentioned explicitly\&. Note, the full list of PAM errors is available in |
| 229 |
/usr/include/security/_pam_types\&.h\&. The |
| 230 |
\fIactionN\fR |
| 231 |
can take one of the following forms: |
| 232 |
.PP |
| 233 |
ignore |
| 234 |
.RS 4 |
| 235 |
when used with a stack of modules, the module\*(Aqs return status will not contribute to the return code the application obtains\&. |
| 236 |
.RE |
| 237 |
.PP |
| 238 |
bad |
| 239 |
.RS 4 |
| 240 |
this action indicates that the return code should be thought of as indicative of the module failing\&. If this module is the first in the stack to fail, its status value will be used for that of the whole stack\&. This is the default action for all return codes\&. |
| 241 |
.RE |
| 242 |
.PP |
| 243 |
die |
| 244 |
.RS 4 |
| 245 |
equivalent to |
| 246 |
\fIbad\fR |
| 247 |
with the side effect of terminating the module stack and PAM immediately returning to the application\&. |
| 248 |
.RE |
| 249 |
.PP |
| 250 |
ok |
| 251 |
.RS 4 |
| 252 |
this tells PAM that the administrator thinks this return code should contribute directly to the return code of the full stack of modules\&. In other words, if the former state of the stack would lead to a return of |
| 253 |
\fIPAM_SUCCESS\fR, the module\*(Aqs return code will override this value\&. Note, if the former state of the stack holds some value that is indicative of a modules failure, this \*(Aqok\*(Aq value will not be used to override that value\&. |
| 254 |
.RE |
| 255 |
.PP |
| 256 |
done |
| 257 |
.RS 4 |
| 258 |
equivalent to |
| 259 |
\fIok\fR |
| 260 |
with the side effect of terminating the module stack and PAM immediately returning to the application unless there was a non\-ignored module failure before\&. |
| 261 |
.RE |
| 262 |
.PP |
| 263 |
N (an unsigned integer) |
| 264 |
.RS 4 |
| 265 |
jump over the next N modules in the stack\&. Note that N equal to 0 is not allowed, it would be treated as |
| 266 |
\fIignore\fR |
| 267 |
in such case\&. The side effect depends on the PAM function call: for |
| 268 |
\fIpam_authenticate\fR, |
| 269 |
\fIpam_acct_mgmt\fR, |
| 270 |
\fIpam_chauthtok\fR, and |
| 271 |
\fIpam_open_session\fR |
| 272 |
it is |
| 273 |
\fIignore\fR; for |
| 274 |
\fIpam_setcred\fR |
| 275 |
and |
| 276 |
\fIpam_close_session\fR |
| 277 |
it is one of |
| 278 |
\fIignore\fR, |
| 279 |
\fIok\fR, or |
| 280 |
\fIbad\fR |
| 281 |
depending on the module\*(Aqs return value\&. |
| 282 |
.RE |
| 283 |
.PP |
| 284 |
reset |
| 285 |
.RS 4 |
| 286 |
clear all memory of the state of the module stack and start again with the next stacked module\&. |
| 287 |
.RE |
| 288 |
.PP |
| 289 |
If a return code\*(Aqs action is not specifically defined via a |
| 290 |
\fIvalueN\fR |
| 291 |
token, and the |
| 292 |
\fIdefault\fR |
| 293 |
value is not specified, that return code\*(Aqs action defaults to |
| 294 |
\fIbad\fR\&. |
| 295 |
.PP |
| 296 |
Each of the four keywords: required; requisite; sufficient; and optional, have an equivalent expression in terms of the [\&.\&.\&.] syntax\&. They are as follows: |
| 297 |
.PP |
| 298 |
required |
| 299 |
.RS 4 |
| 300 |
[success=ok new_authtok_reqd=ok ignore=ignore default=bad] |
| 301 |
.RE |
| 302 |
.PP |
| 303 |
requisite |
| 304 |
.RS 4 |
| 305 |
[success=ok new_authtok_reqd=ok ignore=ignore default=die] |
| 306 |
.RE |
| 307 |
.PP |
| 308 |
sufficient |
| 309 |
.RS 4 |
| 310 |
[success=done new_authtok_reqd=done default=ignore] |
| 311 |
.RE |
| 312 |
.PP |
| 313 |
optional |
| 314 |
.RS 4 |
| 315 |
[success=ok new_authtok_reqd=ok default=ignore] |
| 316 |
.RE |
| 317 |
.PP |
| 318 |
\fImodule\-path\fR |
| 319 |
is either the full filename of the PAM to be used by the application (it begins with a \*(Aq/\*(Aq), or a relative pathname from the default module location: |
| 320 |
/lib/security/ |
| 321 |
or |
| 322 |
/lib64/security/, depending on the architecture\&. |
| 323 |
.PP |
| 324 |
\fImodule\-arguments\fR |
| 325 |
are a space separated list of tokens that can be used to modify the specific behavior of the given PAM\&. Such arguments will be documented for each individual module\&. Note, if you wish to include spaces in an argument, you should surround that argument with square brackets\&. |
| 326 |
.sp |
| 327 |
.if n \{\ |
| 328 |
.RS 4 |
| 329 |
.\} |
| 330 |
.nf |
| 331 |
squid auth required pam_mysql\&.so user=passwd_query passwd=mada \e |
| 332 |
db=eminence [query=select user_name from internet_service \e |
| 333 |
where user_name=\*(Aq%u\*(Aq and password=PASSWORD(\*(Aq%p\*(Aq) and \e |
| 334 |
service=\*(Aqweb_proxy\*(Aq] |
| 335 |
|
| 336 |
.fi |
| 337 |
.if n \{\ |
| 338 |
.RE |
| 339 |
.\} |
| 340 |
.PP |
| 341 |
When using this convention, you can include `[\*(Aq characters inside the string, and if you wish to include a `]\*(Aq character inside the string that will survive the argument parsing, you should use `\e]\*(Aq\&. In other words: |
| 342 |
.sp |
| 343 |
.if n \{\ |
| 344 |
.RS 4 |
| 345 |
.\} |
| 346 |
.nf |
| 347 |
[\&.\&.[\&.\&.\e]\&.\&.] \-\-> \&.\&.[\&.\&.]\&.\&. |
| 348 |
|
| 349 |
.fi |
| 350 |
.if n \{\ |
| 351 |
.RE |
| 352 |
.\} |
| 353 |
.PP |
| 354 |
Any line in (one of) the configuration file(s), that is not formatted correctly, will generally tend (erring on the side of caution) to make the authentication process fail\&. A corresponding error is written to the system log files with a call to |
| 355 |
\fBsyslog\fR(3)\&. |
| 356 |
.PP |
| 357 |
More flexible than the single configuration file is it to configure libpam via the contents of |
| 358 |
pam\&.d |
| 359 |
directories\&. In this case the directories are filled with files each of which has a filename equal to a service\-name (in lower\-case): it is the personal configuration file for the named service\&. |
| 360 |
.PP |
| 361 |
Vendor\-supplied PAM configuration files might be installed in the system directory |
| 362 |
/usr/lib/pam\&.d/ |
| 363 |
or a configurable vendor specific directory instead of the machine configuration directory |
| 364 |
/etc/pam\&.d/\&. If no machine configuration file is found, the vendor\-supplied file is used\&. All files in |
| 365 |
/etc/pam\&.d/ |
| 366 |
override files with the same name in other directories\&. |
| 367 |
.PP |
| 368 |
The syntax of each file in pam\&.d is similar to that of the |
| 369 |
/etc/pam\&.conf |
| 370 |
file and is made up of lines of the following form: |
| 371 |
.sp |
| 372 |
.if n \{\ |
| 373 |
.RS 4 |
| 374 |
.\} |
| 375 |
.nf |
| 376 |
type control module\-path module\-arguments |
| 377 |
|
| 378 |
.fi |
| 379 |
.if n \{\ |
| 380 |
.RE |
| 381 |
.\} |
| 382 |
.PP |
| 383 |
The only difference being that the service\-name is not present\&. The service\-name is of course the name of the given configuration file\&. For example, |
| 384 |
/etc/pam\&.d/login |
| 385 |
contains the configuration for the |
| 386 |
\fBlogin\fR |
| 387 |
service\&. |
| 388 |
.SH "FILES" |
| 389 |
.PP |
| 390 |
/etc/pam\&.conf |
| 391 |
.RS 4 |
| 392 |
the configuration file |
| 393 |
.RE |
| 394 |
.PP |
| 395 |
/etc/pam\&.d |
| 396 |
.RS 4 |
| 397 |
the |
| 398 |
\fBLinux\-PAM\fR |
| 399 |
configuration directory\&. Generally, if this directory is present, the |
| 400 |
/etc/pam\&.conf |
| 401 |
file is ignored\&. |
| 402 |
.RE |
| 403 |
.PP |
| 404 |
/usr/lib/pam\&.d |
| 405 |
.RS 4 |
| 406 |
the |
| 407 |
\fBLinux\-PAM\fR |
| 408 |
vendor configuration directory\&. Files in |
| 409 |
/etc/pam\&.d |
| 410 |
override files with the same name in this directory\&. |
| 411 |
.RE |
| 412 |
.SH "SEE ALSO" |
| 413 |
.PP |
| 414 |
\fBpam\fR(3), |
| 415 |
\fBPAM\fR(8), |
| 416 |
\fBpam_start\fR(3) |