PAM_ENV.CONF(5)

๐Ÿ’– PAM_ENV.CONF(5) ๐Ÿ’–

okay bestie, gather round, because this is the Linux-PAM page about pam_env.conf and honestly? it's giving "environment variables but make it a whole personality". let's go ๐Ÿซถ


โœจ NAME โœจ

pam_env.conf, environment โ€” the environment variables config files. yes that's it, that's the name, two files one legend ๐Ÿ’…


๐ŸŒธ DESCRIPTION ๐ŸŒธ

so the /etc/security/pam_env.conf file is where you tell pam_env(8) which environment variables to set, unset or modify. when someone logs in, this file gets read and the environment variables get set accordingly. that's the whole vibe. ๐ŸŒˆ

every line starts with the variable name, and then there are two possible options for each variable: DEFAULT and OVERRIDE.

  • DEFAULT lets an administrator set the value of the variable to some default value โ€” and if none is supplied, then the empty string is assumed. lowkey generous of it.
  • OVERRIDE tells pam_env that it should enter in its value (overriding the default value) if there is one to use. when OVERRIDE is not used, "" is assumed and no override will be done. periodt.

the shape of a line is literally:

VARIABLE [DEFAULT=[value]] [OVERRIDE=[value]]

(possibly non-existent) environment variables may be used in values using the ${string} syntax, and (possibly non-existent) PAM_ITEMs as well as HOME and SHELL may be used in values using the @{string} syntax. both the $ and @ characters can be backslash escaped to be used as literal values, values can be delimited with "", escaped " not supported. ๐Ÿ‘‘

โš ๏ธ ok real talk, important heads up: note that many environment variables that you would like to use may not be set by the time the module is called. for example, ${HOME} is used below several times, but many PAM applications don't make it available by the time you need it. ๐Ÿ˜ญ the special variables @{HOME} and @{SHELL} are expanded to the values for the user from the corresponding passwd entry. so those two are the reliable besties.

the "#" character at start of line (no space at front) can be used to mark this line as a comment line. no leading space, we mean it, she's picky ๐Ÿ’…

and then there's the /etc/environment file, which specifies the environment variables to be set. this file must consist of simple NAME=VALUE pairs on separate lines. the pam_env(8) module will read this file after the pam_env.conf file. order matters, queen. ๐ŸŽ€


๐Ÿฆ‹ EXAMPLES ๐Ÿฆ‹

these are some example lines which might be specified in /etc/security/pam_env.conf. so cute, so useful, let's study them like they're flashcards. โญ

set the REMOTEHOST variable for any hosts that are remote, default to "localhost" rather than not being set at all:

          REMOTEHOST     DEFAULT=localhost OVERRIDE=@{PAM_RHOST}

set the DISPLAY variable if it seems reasonable:

          DISPLAY        DEFAULT=${REMOTEHOST}:0.0 OVERRIDE=${DISPLAY}

now some simple variables:

          PAGER          DEFAULT=less
          MANPAGER       DEFAULT=less
          LESS           DEFAULT="M q e h15 z23 b80"
          NNTPSERVER     DEFAULT=localhost
          PATH           DEFAULT=${HOME}/bin:/usr/local/bin:/bin\
          :/usr/bin:/usr/local/bin/X11:/usr/bin/X11
          XDG_DATA_HOME  DEFAULT=@{HOME}/share/

and silly examples of escaped variables, just to show how they work. ngl these are my faves ๐Ÿ™ˆ

          DOLLAR         DEFAULT=\$
          DOLLARDOLLAR   DEFAULT=        OVERRIDE=\$${DOLLAR}
          DOLLARPLUS     DEFAULT=\${REMOTEHOST}${REMOTEHOST}
          ATSIGN         DEFAULT=""      OVERRIDE=\@

๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

pam_env(8), pam.d(5), pam(8), environ(7)


๐Ÿ’œ AUTHOR ๐Ÿ’œ

pam_env was written by Dave Kinchlea <kinch@kinch.ark.com>. iconic behaviour, we stan. ๐Ÿซถ


and that's the whole page bestie, you ate it, no cap. this was the Linux-PAM Manual situation, version dated 09/27/2026, PAM_ENV.CONF(5) โ€” mwah, go forth and configure your environment variables responsibly. ๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from