pam_exec.8 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. '\" t
  2. .\" Title: pam_exec
  3. .\" Author: [see the "AUTHOR" section]
  4. .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
  5. .\" Date: 09/03/2021
  6. .\" Manual: Linux-PAM Manual
  7. .\" Source: Linux-PAM Manual
  8. .\" Language: English
  9. .\"
  10. .TH "PAM_EXEC" "8" "09/03/2021" "Linux-PAM Manual" "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. \fBdebug\fR
  61. .RS 4
  62. Print debug information\&.
  63. .RE
  64. .PP
  65. \fBexpose_authtok\fR
  66. .RS 4
  67. During authentication 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. \fBlog=\fR\fB\fIfile\fR\fR
  74. .RS 4
  75. The output of the command is appended to
  76. file
  77. .RE
  78. .PP
  79. \fBtype=\fR\fB\fItype\fR\fR
  80. .RS 4
  81. Only run the command if the module type matches the given type\&.
  82. .RE
  83. .PP
  84. \fBstdout\fR
  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. \fBquiet\fR
  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. \fBquiet_log\fR
  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. \fBseteuid\fR
  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. .fi
  163. .if n \{\
  164. .RE
  165. .\}
  166. .sp
  167. This will execute the command
  168. .sp
  169. .if n \{\
  170. .RS 4
  171. .\}
  172. .nf
  173. make \-C /var/yp
  174. .fi
  175. .if n \{\
  176. .RE
  177. .\}
  178. .sp
  179. with effective user ID\&.
  180. .SH "SEE ALSO"
  181. .PP
  182. \fBpam.conf\fR(5),
  183. \fBpam.d\fR(5),
  184. \fBpam\fR(8)
  185. .SH "AUTHOR"
  186. .PP
  187. pam_exec was written by Thorsten Kukuk <kukuk@thkukuk\&.de> and Josh Triplett <josh@joshtriplett\&.org>\&.