pam_xauth.8.xml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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_xauth">
  5. <refmeta>
  6. <refentrytitle>pam_xauth</refentrytitle>
  7. <manvolnum>8</manvolnum>
  8. <refmiscinfo class="sectdesc">Linux-PAM Manual</refmiscinfo>
  9. </refmeta>
  10. <refnamediv id="pam_xauth-name">
  11. <refname>pam_xauth</refname>
  12. <refpurpose>PAM module to forward xauth keys between users</refpurpose>
  13. </refnamediv>
  14. <refsynopsisdiv>
  15. <cmdsynopsis id="pam_xauth-cmdsynopsis">
  16. <command>pam_xauth.so</command>
  17. <arg choice="opt">
  18. debug
  19. </arg>
  20. <arg choice="opt">
  21. xauthpath=<replaceable>/path/to/xauth</replaceable>
  22. </arg>
  23. <arg choice="opt">
  24. systemuser=<replaceable>UID</replaceable>
  25. </arg>
  26. <arg choice="opt">
  27. targetuser=<replaceable>UID</replaceable>
  28. </arg>
  29. </cmdsynopsis>
  30. </refsynopsisdiv>
  31. <refsect1 id="pam_xauth-description">
  32. <title>DESCRIPTION</title>
  33. <para>
  34. The pam_xauth PAM module is designed to forward xauth keys
  35. (sometimes referred to as "cookies") between users.
  36. </para>
  37. <para>
  38. Without pam_xauth, when xauth is enabled and a user uses the
  39. <citerefentry>
  40. <refentrytitle>su</refentrytitle><manvolnum>1</manvolnum>
  41. </citerefentry> command to assume another user's privileges,
  42. that user is no longer able to access the original user's X display
  43. because the new user does not have the key needed to access the
  44. display. pam_xauth solves the problem by forwarding the key from
  45. the user running su (the source user) to the user whose identity the
  46. source user is assuming (the target user) when the session is created,
  47. and destroying the key when the session is torn down.
  48. </para>
  49. <para>
  50. This means, for example, that when you run
  51. <citerefentry>
  52. <refentrytitle>su</refentrytitle><manvolnum>1</manvolnum>
  53. </citerefentry> from an xterm session, you will be able to run
  54. X programs without explicitly dealing with the
  55. <citerefentry>
  56. <refentrytitle>xauth</refentrytitle><manvolnum>1</manvolnum>
  57. </citerefentry> xauth command or ~/.Xauthority files.
  58. </para>
  59. <para>
  60. pam_xauth will only forward keys if xauth can list a key connected
  61. to the $DISPLAY environment variable.
  62. </para>
  63. <para>
  64. Primitive access control is provided by
  65. <filename>~/.xauth/export</filename> in the invoking user's home
  66. directory and <filename>~/.xauth/import</filename> in the target
  67. user's home directory.
  68. </para>
  69. <para>
  70. If a user has a <filename>~/.xauth/import</filename> file, the user
  71. will only receive cookies from users listed in the file. If there is
  72. no <filename>~/.xauth/import</filename> file, the user will accept
  73. cookies from any other user.
  74. </para>
  75. <para>
  76. If a user has a <filename>.xauth/export</filename> file, the user will
  77. only forward cookies to users listed in the file. If there is no
  78. <filename>~/.xauth/export</filename> file, and the invoking user is
  79. not <emphasis remap='B'>root</emphasis>, the user will forward cookies
  80. to any other user. If there is no <filename>~/.xauth/export</filename>
  81. file, and the invoking user is <emphasis remap='B'>root</emphasis>,
  82. the user will <emphasis remap='I'>not</emphasis> forward cookies to
  83. other users.
  84. </para>
  85. <para>
  86. Both the import and export files support wildcards (such as
  87. <emphasis remap='I'>*</emphasis>). Both the import and export files
  88. can be empty, signifying that no users are allowed.
  89. </para>
  90. </refsect1>
  91. <refsect1 id="pam_xauth-options">
  92. <title>OPTIONS</title>
  93. <variablelist>
  94. <varlistentry>
  95. <term>
  96. <option>debug</option>
  97. </term>
  98. <listitem>
  99. <para>
  100. Print debug information.
  101. </para>
  102. </listitem>
  103. </varlistentry>
  104. <varlistentry>
  105. <term>
  106. <option>xauthpath=<replaceable>/path/to/xauth</replaceable></option>
  107. </term>
  108. <listitem>
  109. <para>
  110. Specify the path the xauth program (it is expected in
  111. <filename>/usr/X11R6/bin/xauth</filename>,
  112. <filename>/usr/bin/xauth</filename>, or
  113. <filename>/usr/bin/X11/xauth</filename> by default).
  114. </para>
  115. </listitem>
  116. </varlistentry>
  117. <varlistentry>
  118. <term>
  119. <option>systemuser=<replaceable>UID</replaceable></option>
  120. </term>
  121. <listitem>
  122. <para>
  123. Specify the highest UID which will be assumed to belong to a
  124. "system" user. pam_xauth will refuse to forward credentials to
  125. users with UID less than or equal to this number, except for
  126. root and the "targetuser", if specified.
  127. </para>
  128. </listitem>
  129. </varlistentry>
  130. <varlistentry>
  131. <term>
  132. <option>targetuser=<replaceable>UID</replaceable></option>
  133. </term>
  134. <listitem>
  135. <para>
  136. Specify a single target UID which is exempt from the
  137. systemuser check.
  138. </para>
  139. </listitem>
  140. </varlistentry>
  141. </variablelist>
  142. </refsect1>
  143. <refsect1 id="pam_xauth-types">
  144. <title>MODULE TYPES PROVIDED</title>
  145. <para>
  146. Only the <emphasis remap='B'>session</emphasis> type is provided.
  147. </para>
  148. </refsect1>
  149. <refsect1 id='pam_xauth-return_values'>
  150. <title>RETURN VALUES</title>
  151. <variablelist>
  152. <varlistentry>
  153. <term>PAM_BUF_ERR</term>
  154. <listitem>
  155. <para>
  156. Memory buffer error.
  157. </para>
  158. </listitem>
  159. </varlistentry>
  160. <varlistentry>
  161. <term>PAM_PERM_DENIED</term>
  162. <listitem>
  163. <para>
  164. Permission denied by import/export file.
  165. </para>
  166. </listitem>
  167. </varlistentry>
  168. <varlistentry>
  169. <term>PAM_SESSION_ERR</term>
  170. <listitem>
  171. <para>
  172. Cannot determine user name, UID or access users home directory.
  173. </para>
  174. </listitem>
  175. </varlistentry>
  176. <varlistentry>
  177. <term>PAM_SUCCESS</term>
  178. <listitem>
  179. <para>
  180. Success.
  181. </para>
  182. </listitem>
  183. </varlistentry>
  184. <varlistentry>
  185. <term>PAM_USER_UNKNOWN</term>
  186. <listitem>
  187. <para>
  188. User not known.
  189. </para>
  190. </listitem>
  191. </varlistentry>
  192. </variablelist>
  193. </refsect1>
  194. <refsect1 id='pam_xauth-examples'>
  195. <title>EXAMPLES</title>
  196. <para>
  197. Add the following line to <filename>/etc/pam.d/su</filename> to
  198. forward xauth keys between users when calling su:
  199. <programlisting>
  200. session optional pam_xauth.so
  201. </programlisting>
  202. </para>
  203. </refsect1>
  204. <refsect1 id="pam_xauth-implementation">
  205. <title>IMPLEMENTATION DETAILS</title>
  206. <para>
  207. pam_xauth will work <emphasis remap='I'>only</emphasis> if it is
  208. used from a setuid application in which the
  209. <function>getuid</function>() call returns the id of the user
  210. running the application, and for which PAM can supply the name
  211. of the account that the user is attempting to assume. The typical
  212. application of this type is
  213. <citerefentry>
  214. <refentrytitle>su</refentrytitle><manvolnum>1</manvolnum>
  215. </citerefentry>.
  216. The application must call both <function>pam_open_session</function>()
  217. and <function>pam_close_session</function>() with the ruid set to the
  218. uid of the calling user and the euid set to root, and must have
  219. provided as the PAM_USER item the name of the target user.
  220. </para>
  221. <para>
  222. pam_xauth calls
  223. <citerefentry>
  224. <refentrytitle>xauth</refentrytitle><manvolnum>1</manvolnum>
  225. </citerefentry> as the source user to extract the key for $DISPLAY,
  226. then calls xauth as the target user to merge the key into the a
  227. temporary database and later remove the database.
  228. </para>
  229. <para>
  230. pam_xauth cannot be told to not remove the keys when the session
  231. is closed.
  232. </para>
  233. </refsect1>
  234. <refsect1 id="pam_lastlog-files">
  235. <title>FILES</title>
  236. <variablelist>
  237. <varlistentry>
  238. <term><filename>~/.xauth/import</filename></term>
  239. <listitem>
  240. <para>XXX</para>
  241. </listitem>
  242. </varlistentry>
  243. <varlistentry>
  244. <term><filename>~/.xauth/export</filename></term>
  245. <listitem>
  246. <para>XXX</para>
  247. </listitem>
  248. </varlistentry>
  249. </variablelist>
  250. </refsect1>
  251. <refsect1 id='pam_xauth-see_also'>
  252. <title>SEE ALSO</title>
  253. <para>
  254. <citerefentry>
  255. <refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum>
  256. </citerefentry>,
  257. <citerefentry>
  258. <refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum>
  259. </citerefentry>,
  260. <citerefentry>
  261. <refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum>
  262. </citerefentry>
  263. </para>
  264. </refsect1>
  265. <refsect1 id='pam_xauth-author'>
  266. <title>AUTHOR</title>
  267. <para>
  268. pam_xauth was written by Nalin Dahyabhai &lt;nalin@redhat.com&gt;,
  269. based on original version by
  270. Michael K. Johnson &lt;johnsonm@redhat.com&gt;.
  271. </para>
  272. </refsect1>
  273. </refentry>