PAM.CONF(5)
๐ PAM.CONF(5)
okay bestie, welcome to the Linux-PAM Manual โจ this is section 5, the file-formats girlies. We're talking pam.conf, pam.d โ the config files that decide who gets in and who does not. ๐
๐ NAME ๐
pam.conf, pam.d โ the PAM configuration files. that's it, that's the name. ๐
๐ฆ DESCRIPTION ๐ฆ
so when a PAM-aware privilege-granting application starts up, it activates its attachment to the PAM-API. that activation does a whole bunch of tasks, and the most important one is reading the configuration file(s): /etc/pam.conf. Alternatively and preferably, the config can be set by individual configuration files living in a pam.d directory. and here's the tea: the moment that directory exists, Linux-PAM will straight up ignore /etc/pam.conf. periodt. ๐ซถ
these files list the PAMs that are gonna do the authentication tasks your service needs, plus how the PAM-API should behave when individual PAMs fail. ๐ญ
the syntax of the /etc/pam.conf config file goes like this: the file is made up of a list of rules, and each rule is typically on a single line โ but it can be extended with an escaped end of line: \<LF>. comments are preceded with # marks and run all the way to the next end of line. ๐
the format of each rule is a space-separated collection of tokens, and the first three are case-insensitive:
service type control module-path module-arguments
the syntax of files inside the /etc/pam.d/ directory is identical, except there's no service field. in that case the service is the name of the file in the /etc/pam.d/ directory. and that filename must be in lower case. no shouting in the directory, bestie. ๐
an important feature of PAM is that a number of rules can be stacked to combine the services of a number of PAMs for a given authentication task. stacking is iconic, we love her. ๐
the service is typically the familiar name of the corresponding application: login and su are good examples. the service-name other is reserved for giving default rules. only lines that mention the current service (or, in the absence of such, the other entries) will be associated with the given service-application. โจ
the type is the management group that the rule corresponds to. it's used to specify which of the management groups the subsequent module gets associated with. valid entries are:
accountโ this module type performs non-authentication-based account management. it's typically used to restrict/permit access to a service based on the time of day, currently available system resources (like the maximum number of users), or maybe the location of the applicant user โ you know,rootlogin only on the console energy. ๐authโ this module type provides two aspects of authenticating the user. first, 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. second, the module can grant group membership or other privileges through its credential-granting properties. main character behaviour fr. โจpasswordโ this module type is required for updating the authentication token associated with the user. typically there's one module for eachchallenge/response-based authentication (auth) type. ๐sessionโ 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 logging information concerning the opening/closing of some data exchange with a user, mounting directories, etc. ๐ฆ
if thetypevalue from that list above gets prepended with a-character, the PAM library will not log to the system log if it's not possible to load the module because it's missing in the system. this is useful especially for modules which aren't always installed on the system and aren't required for correct authentication and authorization of the login session. lowkey a lifesaver. ๐
the third field, control, indicates the behaviour 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, and the more complicated one involves a square-bracketed selection of value=action pairs. ๐ซถ
for the simple (historical) syntax, valid control values are:
requiredโ failure of such a PAM will ultimately lead to the PAM-API returning failure, but only after the remaining stacked modules (for this service and type) have been invoked. she waits her turn, respectfully. ๐requisiteโ likerequired, except 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 the one associated with the firstrequiredorrequisitemodule 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's conceivable that such behaviour 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. ๐ญsufficientโ if such a module succeeds and no priorrequiredmodule 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 asufficientmodule is ignored and processing of the PAM module stack continues unaffected. she said "not my problem" and moved on. ๐optionalโ the success or failure of this module is only important if it's the only module in the stack associated with this service+type. ๐includeโ include all lines of given type from the configuration file specified as an argument to this control. ๐substackโ include all lines of given type from the configuration file specified as an argument to this control. this differs fromincludein that evaluation of thedoneanddieactions in a substack does not cause skipping the rest of the complete module stack โ 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. theresetaction will reset the state of a module stack to the state it was in as of the beginning of the substack evaluation. it's giving nested, but make it contained. ๐
for the more complicated syntax, valid control values have this form:
[value1=action1 value2=action2 ...]
where valueN corresponds to the return code from the function invoked in the module for which the line is defined. it's selected from one of these: success, open_err, symbol_err, service_err, system_err, buf_err, perm_denied, auth_err, cred_insufficient, authinfo_unavail, user_unknown, maxtries, new_authtok_reqd, acct_expired, session_err, cred_unavail, cred_expired, cred_err, no_module_data, conv_err, authtok_err, authtok_recover_err, authtok_lock_busy, authtok_disable_aging, try_again, ignore, abort, authtok_expired, module_unknown, bad_item, conv_again, incomplete, and default. that's the whole roster, bestie, don't skip anyone. ๐ธ
the last of these, default, implies "all valueNs not mentioned explicitly". note, the full list of PAM errors is available in /usr/include/security/_pam_types.h. ๐
the actionN can take one of the following forms:
ignoreโ when used with a stack of modules, the module's return status will not contribute to the return code the application obtains. she's just here for the vibes. ๐badโ 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. ๐dieโ equivalent tobad, with the side effect of terminating the module stack and PAM immediately returning to the application. dramatic exit, we stan. ๐okโ 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 ofPAM_SUCCESS, the module's return code will override this value. note, if the former state of the stack holds some value that's indicative of a modules failure, thisokvalue will not be used to override that value. ๐ญdoneโ equivalent took, 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. ๐N(an unsigned integer) โ jump over the nextNmodules in the stack. note thatNequal to0is not allowed, it would be treated asignorein such case. the side effect depends on the PAM function call: forpam_authenticate,pam_acct_mgmt,pam_chauthtok, andpam_open_sessionit isignore; forpam_setcredandpam_close_sessionit is one ofignore,ok, orbaddepending on the module's return value. ๐ฆresetโ clear all memory of the state of the module stack and start again with the next stacked module. factory reset energy. โจ
if a return code's action isn't specifically defined via a valueN token, and the default value isn't specified, that return code's action defaults to bad. no cap. ๐ญ
each of the four keywords โ required, requisite, sufficient, and optional โ has an equivalent expression in terms of the [...] syntax. they go like this:
requiredโ[success=ok new_authtok_reqd=ok ignore=ignore default=bad]requisiteโ[success=ok new_authtok_reqd=ok ignore=ignore default=die]sufficientโ[success=done new_authtok_reqd=done default=ignore]optionalโ[success=ok new_authtok_reqd=ok default=ignore]
module-path is either the full filename of the PAM to be used by the application (it begins with a /), or a relative pathname from the default module location: /lib/security/ or /lib64/security/, depending on the architecture. ๐ง
module-arguments are a space-separated list of tokens that can be used to modify the specific behaviour 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. like so, bestie:
squid auth required pam_mysql.so user=passwd_query passwd=mada \
db=eminence [query=select user_name from internet_service \
where user_name='%u' and password=PASSWORD('%p') and \
service='web_proxy']
when you're using this convention, you can include [ characters inside the string. and if you wish to include a ] character inside the string that will survive the argument parsing, you should use \]. in other words:
[..[..\]..] --> ..[..]..
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 syslog(3). so like. don't be sloppy with your syntax, it's literally not the vibe. ๐
okay so here's the โจglow-upโจ version of configuring PAM โ the whole pam.d directory situation, which is so much more flexible than that one single lonely config file. Instead of cramming everything into one file, you configure libpam by filling up the pam.d directories with files. Each file's name is literally equal to a service-name (in lower-case, bestie, don't get cute with it) โ and that file becomes the personal, bespoke configuration file for that named service. It's giving custom fit, tailored, main character energy. ๐
and here's the vendor tea โ โ vendor-supplied PAM configuration files might be installed in the system directory /usr/lib/pam.d/, or in a configurable vendor specific directory, instead of the machine configuration directory /etc/pam.d/. If no machine configuration file is found, the vendor-supplied file gets used. And every single file in /etc/pam.d/ overrides files with the same name in other directories. Your machine's files run the group chat, periodt. ๐
The syntax of each file in pam.d is similar to that of the /etc/pam.conf file, and it's made up of lines that look exactly like this:
type control module-path module-arguments
The only difference? The service-name is not present. The service-name is, of course, the name of the given configuration file itself. For example, /etc/pam.d/login contains the configuration for the login service. no cap, that's the whole trick ๐
โจ FILES โจ ๐ฆ
/etc/pam.confโ the configuration file ๐ธ/etc/pam.dโ the Linux-PAM configuration directory. Generally, if this directory is present, the/etc/pam.conffile is ignored. ๐/usr/lib/pam.dโ the Linux-PAM vendor configuration directory. Files in/etc/pam.doverride files with the same name in this directory. ๐ฅ
๐ SEE ALSO ๐
like, go read those too, i'm literally begging ๐ซถ
okay bestie that's the whole page, you ate that ๐ This was Linux-PAM, dated 09/27/2026, filed under PAM.CONF(5) โ iconic behavior honestly, obsessed with her โจ๐งโโ๏ธ๐
๐ฆ where this page comes from
- arch rolling: pam 1.7.3-1 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms