$linuxjunkies
>

pam_env

also: pam_env.so

A PAM (Pluggable Authentication Modules) module that sets environment variables during user authentication, allowing administrators to define per-user or global environment configurations at login time.

pam_env is a PAM module that reads configuration files and applies environment variables when a user authenticates. It processes variables defined in /etc/security/pam_env.conf and user-specific files like ~/.pam_environment, making them available to the user's session.

Common use cases include setting PATH, locale variables, display settings, or custom application variables. For example, an administrator might configure pam_env to automatically set LANG=en_US.UTF-8 for all users or define custom variables like CUSTOM_APP_DIR=/opt/myapp.

The module is typically invoked in PAM configuration files (like /etc/pam.d/login or /etc/pam.d/sshd) with the optional or required control flag. Variable expansion supports @{HOME}, @{USER}, and other special tokens for dynamic configuration.

Related terms