| 1 |
'\" t |
| 2 |
.\" Title: pam_exec |
| 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_EXEC" "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_exec \- PAM module which calls an external command |
| 32 |
.SH "SYNOPSIS" |
| 33 |
.HP \w'\fBpam_exec\&.so\fR\ 'u |
| 34 |
\fBpam_exec\&.so\fR [debug] [expose_authtok] [seteuid] [quiet] [quiet_log] [stdout] [log=\fIfile\fR] [type=\fItype\fR] \fIcommand\fR [\fI\&.\&.\&.\fR] |
| 35 |
.SH "DESCRIPTION" |
| 36 |
.PP |
| 37 |
pam_exec is a PAM module that can be used to run an external command\&. |
| 38 |
.PP |
| 39 |
The child\*(Aqs environment is set to the current PAM environment list, as returned by |
| 40 |
\fBpam_getenvlist\fR(3) |
| 41 |
In addition, the following PAM items are exported as environment variables: |
| 42 |
\fIPAM_RHOST\fR, |
| 43 |
\fIPAM_RUSER\fR, |
| 44 |
\fIPAM_SERVICE\fR, |
| 45 |
\fIPAM_TTY\fR, |
| 46 |
\fIPAM_USER\fR |
| 47 |
and |
| 48 |
\fIPAM_TYPE\fR, which contains one of the module types: |
| 49 |
\fBaccount\fR, |
| 50 |
\fBauth\fR, |
| 51 |
\fBpassword\fR, |
| 52 |
\fBopen_session\fR |
| 53 |
and |
| 54 |
\fBclose_session\fR\&. |
| 55 |
.PP |
| 56 |
Commands called by pam_exec need to be aware of that the user can have control over the environment\&. |
| 57 |
.SH "OPTIONS" |
| 58 |
.PP |
| 59 |
.PP |
| 60 |
debug |
| 61 |
.RS 4 |
| 62 |
Print debug information\&. |
| 63 |
.RE |
| 64 |
.PP |
| 65 |
expose_authtok |
| 66 |
.RS 4 |
| 67 |
During authentication and password change the calling command can read the password from |
| 68 |
\fBstdin\fR(3)\&. Only first |
| 69 |
\fIPAM_MAX_RESP_SIZE\fR |
| 70 |
bytes of a password are provided to the command\&. |
| 71 |
.RE |
| 72 |
.PP |
| 73 |
log=file |
| 74 |
.RS 4 |
| 75 |
The output of the command is appended to |
| 76 |
file |
| 77 |
.RE |
| 78 |
.PP |
| 79 |
type=type |
| 80 |
.RS 4 |
| 81 |
Only run the command if the module type matches the given type\&. |
| 82 |
.RE |
| 83 |
.PP |
| 84 |
stdout |
| 85 |
.RS 4 |
| 86 |
Per default the output of the executed command is written to |
| 87 |
/dev/null\&. With this option, the stdout output of the executed command is redirected to the calling application\&. It\*(Aqs in the responsibility of this application what happens with the output\&. The |
| 88 |
\fBlog\fR |
| 89 |
option is ignored\&. |
| 90 |
.RE |
| 91 |
.PP |
| 92 |
quiet |
| 93 |
.RS 4 |
| 94 |
Per default pam_exec\&.so will echo the exit status of the external command if it fails\&. Specifying this option will suppress the message\&. |
| 95 |
.RE |
| 96 |
.PP |
| 97 |
quiet_log |
| 98 |
.RS 4 |
| 99 |
Per default pam_exec\&.so will log the exit status of the external command if it fails\&. Specifying this option will suppress the log message\&. |
| 100 |
.RE |
| 101 |
.PP |
| 102 |
seteuid |
| 103 |
.RS 4 |
| 104 |
Per default pam_exec\&.so will execute the external command with the real user ID of the calling process\&. Specifying this option means the command is run with the effective user ID\&. |
| 105 |
.RE |
| 106 |
.SH "MODULE TYPES PROVIDED" |
| 107 |
.PP |
| 108 |
All module types (\fBauth\fR, |
| 109 |
\fBaccount\fR, |
| 110 |
\fBpassword\fR |
| 111 |
and |
| 112 |
\fBsession\fR) are provided\&. |
| 113 |
.SH "RETURN VALUES" |
| 114 |
.PP |
| 115 |
.PP |
| 116 |
PAM_SUCCESS |
| 117 |
.RS 4 |
| 118 |
The external command was run successfully\&. |
| 119 |
.RE |
| 120 |
.PP |
| 121 |
PAM_BUF_ERR |
| 122 |
.RS 4 |
| 123 |
Memory buffer error\&. |
| 124 |
.RE |
| 125 |
.PP |
| 126 |
PAM_CONV_ERR |
| 127 |
.RS 4 |
| 128 |
The conversation method supplied by the application failed to obtain the username\&. |
| 129 |
.RE |
| 130 |
.PP |
| 131 |
PAM_INCOMPLETE |
| 132 |
.RS 4 |
| 133 |
The conversation method supplied by the application returned PAM_CONV_AGAIN\&. |
| 134 |
.RE |
| 135 |
.PP |
| 136 |
PAM_SERVICE_ERR |
| 137 |
.RS 4 |
| 138 |
No argument or a wrong number of arguments were given\&. |
| 139 |
.RE |
| 140 |
.PP |
| 141 |
PAM_SYSTEM_ERR |
| 142 |
.RS 4 |
| 143 |
A system error occurred or the command to execute failed\&. |
| 144 |
.RE |
| 145 |
.PP |
| 146 |
PAM_IGNORE |
| 147 |
.RS 4 |
| 148 |
\fBpam_setcred\fR |
| 149 |
was called, which does not execute the command\&. Or, the value given for the type= parameter did not match the module type\&. |
| 150 |
.RE |
| 151 |
.SH "EXAMPLES" |
| 152 |
.PP |
| 153 |
Add the following line to |
| 154 |
/etc/pam\&.d/passwd |
| 155 |
to rebuild the NIS database after each local password change: |
| 156 |
.sp |
| 157 |
.if n \{\ |
| 158 |
.RS 4 |
| 159 |
.\} |
| 160 |
.nf |
| 161 |
password optional pam_exec\&.so seteuid /usr/bin/make \-C /var/yp |
| 162 |
|
| 163 |
.fi |
| 164 |
.if n \{\ |
| 165 |
.RE |
| 166 |
.\} |
| 167 |
.sp |
| 168 |
This will execute the command |
| 169 |
.sp |
| 170 |
.if n \{\ |
| 171 |
.RS 4 |
| 172 |
.\} |
| 173 |
.nf |
| 174 |
make \-C /var/yp |
| 175 |
.fi |
| 176 |
.if n \{\ |
| 177 |
.RE |
| 178 |
.\} |
| 179 |
.sp |
| 180 |
with effective user ID\&. |
| 181 |
.SH "SEE ALSO" |
| 182 |
.PP |
| 183 |
\fBpam.conf\fR(5), |
| 184 |
\fBpam.d\fR(5), |
| 185 |
\fBpam\fR(7) |
| 186 |
.SH "AUTHOR" |
| 187 |
.PP |
| 188 |
pam_exec was written by Thorsten Kukuk <kukuk@thkukuk\&.de> and Josh Triplett <josh@joshtriplett\&.org>\&. |