pam_exec.8.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <?xml version="1.0" encoding='UTF-8'?>
  2. <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
  4. <refentry id="pam_exec">
  5. <refmeta>
  6. <refentrytitle>pam_exec</refentrytitle>
  7. <manvolnum>8</manvolnum>
  8. <refmiscinfo class="sectdesc">Linux-PAM Manual</refmiscinfo>
  9. </refmeta>
  10. <refnamediv id="pam_exec-name">
  11. <refname>pam_exec</refname>
  12. <refpurpose>PAM module which calls an external command</refpurpose>
  13. </refnamediv>
  14. <refsynopsisdiv>
  15. <cmdsynopsis id="pam_exec-cmdsynopsis">
  16. <command>pam_exec.so</command>
  17. <arg choice="opt">
  18. debug
  19. </arg>
  20. <arg choice="opt">
  21. expose_authtok
  22. </arg>
  23. <arg choice="opt">
  24. seteuid
  25. </arg>
  26. <arg choice="opt">
  27. quiet
  28. </arg>
  29. <arg choice="opt">
  30. quiet_log
  31. </arg>
  32. <arg choice="opt">
  33. stdout
  34. </arg>
  35. <arg choice="opt">
  36. log=<replaceable>file</replaceable>
  37. </arg>
  38. <arg choice="opt">
  39. type=<replaceable>type</replaceable>
  40. </arg>
  41. <arg choice="plain">
  42. <replaceable>command</replaceable>
  43. </arg>
  44. <arg choice="opt">
  45. <replaceable>...</replaceable>
  46. </arg>
  47. </cmdsynopsis>
  48. </refsynopsisdiv>
  49. <refsect1 id="pam_exec-description">
  50. <title>DESCRIPTION</title>
  51. <para>
  52. pam_exec is a PAM module that can be used to run
  53. an external command.
  54. </para>
  55. <para>
  56. The child's environment is set to the current PAM environment list, as
  57. returned by
  58. <citerefentry>
  59. <refentrytitle>pam_getenvlist</refentrytitle><manvolnum>3</manvolnum>
  60. </citerefentry>
  61. In addition, the following PAM items are
  62. exported as environment variables: <emphasis>PAM_RHOST</emphasis>,
  63. <emphasis>PAM_RUSER</emphasis>, <emphasis>PAM_SERVICE</emphasis>,
  64. <emphasis>PAM_TTY</emphasis>, <emphasis>PAM_USER</emphasis> and
  65. <emphasis>PAM_TYPE</emphasis>, which contains one of the module
  66. types: <option>account</option>, <option>auth</option>,
  67. <option>password</option>, <option>open_session</option> and
  68. <option>close_session</option>.
  69. </para>
  70. <para>
  71. Commands called by pam_exec need to be aware of that the user
  72. can have control over the environment.
  73. </para>
  74. </refsect1>
  75. <refsect1 id="pam_exec-options">
  76. <title>OPTIONS</title>
  77. <para>
  78. <variablelist>
  79. <varlistentry>
  80. <term>
  81. <option>debug</option>
  82. </term>
  83. <listitem>
  84. <para>
  85. Print debug information.
  86. </para>
  87. </listitem>
  88. </varlistentry>
  89. <varlistentry>
  90. <term>
  91. <option>expose_authtok</option>
  92. </term>
  93. <listitem>
  94. <para>
  95. During authentication the calling command can read
  96. the password from <citerefentry>
  97. <refentrytitle>stdin</refentrytitle><manvolnum>3</manvolnum>
  98. </citerefentry>. Only first <emphasis>PAM_MAX_RESP_SIZE</emphasis>
  99. bytes of a password are provided to the command.
  100. </para>
  101. </listitem>
  102. </varlistentry>
  103. <varlistentry>
  104. <term>
  105. <option>log=<replaceable>file</replaceable></option>
  106. </term>
  107. <listitem>
  108. <para>
  109. The output of the command is appended to
  110. <filename>file</filename>
  111. </para>
  112. </listitem>
  113. </varlistentry>
  114. <varlistentry>
  115. <term>
  116. <option>type=<replaceable>type</replaceable></option>
  117. </term>
  118. <listitem>
  119. <para>
  120. Only run the command if the module type matches the given type.
  121. </para>
  122. </listitem>
  123. </varlistentry>
  124. <varlistentry>
  125. <term>
  126. <option>stdout</option>
  127. </term>
  128. <listitem>
  129. <para>
  130. Per default the output of the executed command is written to <filename>/dev/null</filename>. With this option, the stdout output of the executed command is redirected to the calling application. It's in the responsibility of this application what happens with the output. The <option>log</option> option is ignored.
  131. </para>
  132. </listitem>
  133. </varlistentry>
  134. <varlistentry>
  135. <term>
  136. <option>quiet</option>
  137. </term>
  138. <listitem>
  139. <para>
  140. Per default pam_exec.so will echo the exit status of the
  141. external command if it fails.
  142. Specifying this option will suppress the message.
  143. </para>
  144. </listitem>
  145. </varlistentry>
  146. <varlistentry>
  147. <term>
  148. <option>quiet_log</option>
  149. </term>
  150. <listitem>
  151. <para>
  152. Per default pam_exec.so will log the exit status of the
  153. external command if it fails.
  154. Specifying this option will suppress the log message.
  155. </para>
  156. </listitem>
  157. </varlistentry>
  158. <varlistentry>
  159. <term>
  160. <option>seteuid</option>
  161. </term>
  162. <listitem>
  163. <para>
  164. Per default pam_exec.so will execute the external command
  165. with the real user ID of the calling process.
  166. Specifying this option means the command is run
  167. with the effective user ID.
  168. </para>
  169. </listitem>
  170. </varlistentry>
  171. </variablelist>
  172. </para>
  173. </refsect1>
  174. <refsect1 id="pam_exec-types">
  175. <title>MODULE TYPES PROVIDED</title>
  176. <para>
  177. All module types (<option>auth</option>, <option>account</option>,
  178. <option>password</option> and <option>session</option>) are provided.
  179. </para>
  180. </refsect1>
  181. <refsect1 id='pam_exec-return_values'>
  182. <title>RETURN VALUES</title>
  183. <para>
  184. <variablelist>
  185. <varlistentry>
  186. <term>PAM_SUCCESS</term>
  187. <listitem>
  188. <para>
  189. The external command was run successfully.
  190. </para>
  191. </listitem>
  192. </varlistentry>
  193. <varlistentry>
  194. <term>PAM_BUF_ERR</term>
  195. <listitem>
  196. <para>
  197. Memory buffer error.
  198. </para>
  199. </listitem>
  200. </varlistentry>
  201. <varlistentry>
  202. <term>PAM_CONV_ERR</term>
  203. <listitem>
  204. <para>
  205. The conversation method supplied by the application
  206. failed to obtain the username.
  207. </para>
  208. </listitem>
  209. </varlistentry>
  210. <varlistentry>
  211. <term>PAM_INCOMPLETE</term>
  212. <listitem>
  213. <para>
  214. The conversation method supplied by the application
  215. returned PAM_CONV_AGAIN.
  216. </para>
  217. </listitem>
  218. </varlistentry>
  219. <varlistentry>
  220. <term>PAM_SERVICE_ERR</term>
  221. <listitem>
  222. <para>
  223. No argument or a wrong number of arguments were given.
  224. </para>
  225. </listitem>
  226. </varlistentry>
  227. <varlistentry>
  228. <term>PAM_SYSTEM_ERR</term>
  229. <listitem>
  230. <para>
  231. A system error occurred or the command to execute failed.
  232. </para>
  233. </listitem>
  234. </varlistentry>
  235. <varlistentry>
  236. <term>PAM_IGNORE</term>
  237. <listitem>
  238. <para>
  239. <function>pam_setcred</function> was called, which
  240. does not execute the command. Or, the value given for the type=
  241. parameter did not match the module type.
  242. </para>
  243. </listitem>
  244. </varlistentry>
  245. </variablelist>
  246. </para>
  247. </refsect1>
  248. <refsect1 id='pam_exec-examples'>
  249. <title>EXAMPLES</title>
  250. <para>
  251. Add the following line to <filename>/etc/pam.d/passwd</filename> to
  252. rebuild the NIS database after each local password change:
  253. <programlisting>
  254. password optional pam_exec.so seteuid /usr/bin/make -C /var/yp
  255. </programlisting>
  256. This will execute the command
  257. <programlisting>make -C /var/yp</programlisting>
  258. with effective user ID.
  259. </para>
  260. </refsect1>
  261. <refsect1 id='pam_exec-see_also'>
  262. <title>SEE ALSO</title>
  263. <para>
  264. <citerefentry>
  265. <refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum>
  266. </citerefentry>,
  267. <citerefentry>
  268. <refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum>
  269. </citerefentry>,
  270. <citerefentry>
  271. <refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum>
  272. </citerefentry>
  273. </para>
  274. </refsect1>
  275. <refsect1 id='pam_exec-author'>
  276. <title>AUTHOR</title>
  277. <para>
  278. pam_exec was written by Thorsten Kukuk &lt;kukuk@thkukuk.de&gt; and
  279. Josh Triplett &lt;josh@joshtriplett.org&gt;.
  280. </para>
  281. </refsect1>
  282. </refentry>