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.
DEFAULTlets 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.OVERRIDEtellspam_envthat it should enter in its value (overriding the default value) if there is one to use. whenOVERRIDEis 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
- 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