| 1 |
'\" t |
| 2 |
.\" Title: pam_env |
| 3 |
.\" Author: [see the "AUTHOR" section] |
| 4 |
.\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/> |
| 5 |
.\" Date: 06/29/2025 |
| 6 |
.\" Manual: Linux-PAM Manual |
| 7 |
.\" Source: Linux-PAM |
| 8 |
.\" Language: English |
| 9 |
.\" |
| 10 |
.TH "PAM_ENV" "8" "06/29/2025" "Linux\-PAM" "Linux\-PAM Manual" |
| 11 |
.\" ----------------------------------------------------------------- |
| 12 |
.\" * Define some portability stuff |
| 13 |
.\" ----------------------------------------------------------------- |
| 14 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 15 |
.\" http://bugs.debian.org/507673 |
| 16 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 17 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 18 |
.ie \n(.g .ds Aq \(aq |
| 19 |
.el .ds Aq ' |
| 20 |
.\" ----------------------------------------------------------------- |
| 21 |
.\" * set default formatting |
| 22 |
.\" ----------------------------------------------------------------- |
| 23 |
.\" disable hyphenation |
| 24 |
.nh |
| 25 |
.\" disable justification (adjust text to left margin only) |
| 26 |
.ad l |
| 27 |
.\" ----------------------------------------------------------------- |
| 28 |
.\" * MAIN CONTENT STARTS HERE * |
| 29 |
.\" ----------------------------------------------------------------- |
| 30 |
.SH "NAME" |
| 31 |
pam_env \- PAM module to set/unset environment variables |
| 32 |
.SH "SYNOPSIS" |
| 33 |
.HP \w'\fBpam_env\&.so\fR\ 'u |
| 34 |
\fBpam_env\&.so\fR [debug] [conffile=\fIconf\-file\fR] [envfile=\fIenv\-file\fR] [readenv=\fI0|1\fR] [user_envfile=\fIenv\-file\fR] [user_readenv=\fI0|1\fR] |
| 35 |
.SH "DESCRIPTION" |
| 36 |
.PP |
| 37 |
The pam_env PAM module allows the (un)setting of environment variables\&. Supported is the use of previously set environment variables as well as |
| 38 |
\fIPAM_ITEM\fRs such as |
| 39 |
\fIPAM_RHOST\fR\&. |
| 40 |
.PP |
| 41 |
By default rules for (un)setting of variables are taken from the config file |
| 42 |
/etc/security/pam_env\&.conf\&. An alternate file can be specified with the |
| 43 |
\fIconffile\fR |
| 44 |
option\&. |
| 45 |
.PP |
| 46 |
Second a file (/etc/environment |
| 47 |
by default) with simple |
| 48 |
\fIKEY=VAL\fR |
| 49 |
pairs on separate lines will be read\&. With the |
| 50 |
\fIenvfile\fR |
| 51 |
option an alternate file can be specified\&. And with the |
| 52 |
\fIreadenv\fR |
| 53 |
option this can be completely disabled\&. |
| 54 |
.PP |
| 55 |
Third it will read a user configuration file ($HOME/\&.pam_environment |
| 56 |
by default)\&. The default file can be changed with the |
| 57 |
\fIuser_envfile\fR |
| 58 |
option and it can be turned on and off with the |
| 59 |
\fIuser_readenv\fR |
| 60 |
option\&. |
| 61 |
.PP |
| 62 |
Since setting of PAM environment variables can have side effects to other modules, this module should be the last one on the stack\&. |
| 63 |
.PP |
| 64 |
This module is only executed if the main application calls |
| 65 |
\fBpam_setcred\fR(3) |
| 66 |
or |
| 67 |
\fBpam_open_session\fR(3)\&. The module does nothing and returns |
| 68 |
\fIPAM_IGNORE\fR |
| 69 |
if called by |
| 70 |
\fBpam_authenticate\fR(3)\&. |
| 71 |
.SH "OPTIONS" |
| 72 |
.PP |
| 73 |
conffile=/path/to/pam_env\&.conf |
| 74 |
.RS 4 |
| 75 |
Indicate an alternative |
| 76 |
pam_env\&.conf |
| 77 |
style configuration file to override the default\&. This can be useful when different services need different environments\&. |
| 78 |
.RE |
| 79 |
.PP |
| 80 |
debug |
| 81 |
.RS 4 |
| 82 |
A lot of debug information is printed with |
| 83 |
\fBsyslog\fR(3)\&. |
| 84 |
.RE |
| 85 |
.PP |
| 86 |
envfile=/path/to/environment |
| 87 |
.RS 4 |
| 88 |
Indicate an alternative |
| 89 |
environment |
| 90 |
file to override the default\&. The syntax are simple |
| 91 |
\fIKEY=VAL\fR |
| 92 |
pairs on separate lines\&. The |
| 93 |
\fIexport\fR |
| 94 |
instruction can be specified for bash compatibility, but will be ignored\&. This can be useful when different services need different environments\&. |
| 95 |
.RE |
| 96 |
.PP |
| 97 |
readenv=0|1 |
| 98 |
.RS 4 |
| 99 |
Turns on or off the reading of the file specified by envfile (0 is off, 1 is on)\&. By default this option is on\&. |
| 100 |
.RE |
| 101 |
.PP |
| 102 |
user_envfile=filename |
| 103 |
.RS 4 |
| 104 |
Indicate an alternative |
| 105 |
\&.pam_environment |
| 106 |
file to override the default\&. The syntax is the same as for |
| 107 |
\fI/etc/security/pam_env\&.conf\fR\&. The filename is relative to the user home directory\&. This can be useful when different services need different environments\&. |
| 108 |
.RE |
| 109 |
.PP |
| 110 |
user_readenv=0|1 |
| 111 |
.RS 4 |
| 112 |
Turns on or off the reading of the user specific environment file\&. 0 is off, 1 is on\&. By default this option is off as user supplied environment variables in the PAM environment could affect behavior of subsequent modules in the stack without the consent of the system administrator\&. |
| 113 |
.sp |
| 114 |
Due to problematic security this functionality is deprecated since the 1\&.5\&.0 version and will be removed completely at some point in the future\&. |
| 115 |
.RE |
| 116 |
.SH "MODULE TYPES PROVIDED" |
| 117 |
.PP |
| 118 |
The |
| 119 |
\fBauth\fR |
| 120 |
and |
| 121 |
\fBsession\fR |
| 122 |
module types are provided\&. |
| 123 |
.SH "RETURN VALUES" |
| 124 |
.PP |
| 125 |
PAM_ABORT |
| 126 |
.RS 4 |
| 127 |
Not all relevant data or options could be gotten\&. |
| 128 |
.RE |
| 129 |
.PP |
| 130 |
PAM_BUF_ERR |
| 131 |
.RS 4 |
| 132 |
Memory buffer error\&. |
| 133 |
.RE |
| 134 |
.PP |
| 135 |
PAM_IGNORE |
| 136 |
.RS 4 |
| 137 |
No pam_env\&.conf and environment file was found or the module got called by |
| 138 |
\fBpam_authenticate\fR(3)\&. |
| 139 |
.RE |
| 140 |
.PP |
| 141 |
PAM_SUCCESS |
| 142 |
.RS 4 |
| 143 |
Environment variables were set\&. |
| 144 |
.RE |
| 145 |
.SH "FILES" |
| 146 |
.PP |
| 147 |
/etc/security/pam_env\&.conf |
| 148 |
.RS 4 |
| 149 |
Default configuration file |
| 150 |
.RE |
| 151 |
.PP |
| 152 |
/etc/environment |
| 153 |
.RS 4 |
| 154 |
Default environment file |
| 155 |
.RE |
| 156 |
.PP |
| 157 |
$HOME/\&.pam_environment |
| 158 |
.RS 4 |
| 159 |
User specific environment file |
| 160 |
.RE |
| 161 |
.SH "SEE ALSO" |
| 162 |
.PP |
| 163 |
\fBpam_env.conf\fR(5), |
| 164 |
\fBpam.d\fR(5), |
| 165 |
\fBpam\fR(7), |
| 166 |
\fBenviron\fR(7)\&. |
| 167 |
.SH "AUTHOR" |
| 168 |
.PP |
| 169 |
pam_env was written by Dave Kinchlea <kinch@kinch\&.ark\&.com>\&. |