User:Aimilius/Environment variables

From ArchWiki
Jump to: navigation, search

Using pam_env

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: Give information in sentences and paragraphs, not as comments in a code block. (Discuss in User talk:Aimilius/Environment variables#)

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 simple VARIABLE=value pairs on separate lines, for example:
  • /etc/security/pam_env.conf and ~/.pam_environment share the same following format:
    @{HOME} and @{SHELL} are special variables that expand to what is defined in /etc/passwd. The following example illustrates how to expand the HOME environment variable into another variable:
    Note: The variables ${HOME} and ${SHELL} are not linked to the HOME and SHELL environment variables, they are not set by default.
    The format also allows to expand already defined variables in the values of other variables using ${VARIABLE} , like this:
    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.