User:Aimilius/Environment variables
Using pam_env
The PAM module pam_env(8) loads the variables to be set in the environment from the following files: /etc/security/pam_env.conf
, /etc/environment
and ~/.pam_environment
.
/etc/environment
must consist of simpleVARIABLE=value
pairs on separate lines, for example:EDITOR=NANO
/etc/security/pam_env.conf
and~/.pam_environment
share the same following format:VARIABLE [DEFAULT=value] [OVERRIDE=value]
@{HOME}
and@{SHELL}
are special variables that expand to what is defined in/etc/passwd
. The following example illustrates how to expand theHOME
environment variable into another variable:XDG_CONFIG_HOME DEFAULT=@{HOME}/.config
Note: The variablesThe format also allows to expand already defined variables in the values of other variables using${HOME}
and${SHELL}
are not linked to theHOME
andSHELL
environment variables, they are not set by default.${VARIABLE}
, like this:GNUPGHOME DEFAULT=${XDG_CONFIG_HOME}/gnupg
VARIABLE=value
pairs are also allowed, but variable expansion is not supported in those pairs. See pam_env.conf(5) for more information.
Note: These files are read before other files, in particular before
~/.profile
, ~/.bash_profile
and ~/.zshenv
.