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">
5 <refentry id="pam_xauth">
8 <refentrytitle>pam_xauth</refentrytitle>
9 <manvolnum>8</manvolnum>
10 <refmiscinfo class="sectdesc">Linux-PAM Manual</refmiscinfo>
13 <refnamediv id="pam_xauth-name">
14 <refname>pam_xauth</refname>
15 <refpurpose>PAM module to forward xauth keys between users</refpurpose>
19 <cmdsynopsis id="pam_xauth-cmdsynopsis">
20 <command>pam_xauth.so</command>
25 xauthpath=<replaceable>/path/to/xauth</replaceable>
28 systemuser=<replaceable>UID</replaceable>
31 targetuser=<replaceable>UID</replaceable>
36 <refsect1 id="pam_xauth-description">
37 <title>DESCRIPTION</title>
39 The pam_xauth PAM module is designed to forward xauth keys
40 (sometimes referred to as "cookies") between users.
43 Without pam_xauth, when xauth is enabled and a user uses the
45 <refentrytitle>su</refentrytitle><manvolnum>1</manvolnum>
46 </citerefentry> command to assume another user's privileges,
47 that user is no longer able to access the original user's X display
48 because the new user does not have the key needed to access the
49 display. pam_xauth solves the problem by forwarding the key from
50 the user running su (the source user) to the user whose identity the
51 source user is assuming (the target user) when the session is created,
52 and destroying the key when the session is torn down.
55 This means, for example, that when you run
57 <refentrytitle>su</refentrytitle><manvolnum>1</manvolnum>
58 </citerefentry> from an xterm session, you will be able to run
59 X programs without explicitly dealing with the
61 <refentrytitle>xauth</refentrytitle><manvolnum>1</manvolnum>
62 </citerefentry> xauth command or ~/.Xauthority files.
65 pam_xauth will only forward keys if xauth can list a key connected
66 to the $DISPLAY environment variable.
69 Primitive access control is provided by
70 <filename>~/.xauth/export</filename> in the invoking user's home
71 directory and <filename>~/.xauth/import</filename> in the target
72 user's home directory.
75 If a user has a <filename>~/.xauth/import</filename> file, the user
76 will only receive cookies from users listed in the file. If there is
77 no <filename>~/.xauth/import</filename> file, the user will accept
78 cookies from any other user.
81 If a user has a <filename>.xauth/export</filename> file, the user will
82 only forward cookies to users listed in the file. If there is no
83 <filename>~/.xauth/export</filename> file, and the invoking user is
84 not <emphasis remap='B'>root</emphasis>, the user will forward cookies
85 to any other user. If there is no <filename>~/.xauth/export</filename>
86 file, and the invoking user is <emphasis remap='B'>root</emphasis>,
87 the user will <emphasis remap='I'>not</emphasis> forward cookies to
91 Both the import and export files support wildcards (such as
92 <emphasis remap='I'>*</emphasis>). Both the import and export files
93 can be empty, signifying that no users are allowed.
97 <refsect1 id="pam_xauth-options">
98 <title>OPTIONS</title>
102 <option>debug</option>
106 Print debug information.
112 <option>xauthpath=<replaceable>/path/to/xauth</replaceable></option>
116 Specify the path the xauth program (it is expected in
117 <filename>/usr/X11R6/bin/xauth</filename>,
118 <filename>/usr/bin/xauth</filename>, or
119 <filename>/usr/bin/X11/xauth</filename> by default).
125 <option>systemuser=<replaceable>UID</replaceable></option>
129 Specify the highest UID which will be assumed to belong to a
130 "system" user. pam_xauth will refuse to forward credentials to
131 users with UID less than or equal to this number, except for
132 root and the "targetuser", if specified.
138 <option>targetuser=<replaceable>UID</replaceable></option>
142 Specify a single target UID which is exempt from the
150 <refsect1 id="pam_xauth-types">
151 <title>MODULE TYPES PROVIDED</title>
153 Only the <emphasis remap='B'>session</emphasis> type is provided.
157 <refsect1 id='pam_xauth-return_values'>
158 <title>RETURN VALUES</title>
161 <term>PAM_BUF_ERR</term>
170 <term>PAM_PERM_DENIED</term>
173 Permission denied by import/export file.
179 <term>PAM_SESSION_ERR</term>
182 Cannot determine user name, UID or access users home directory.
188 <term>PAM_SUCCESS</term>
197 <term>PAM_USER_UNKNOWN</term>
208 <refsect1 id='pam_xauth-examples'>
209 <title>EXAMPLES</title>
211 Add the following line to <filename>/etc/pam.d/su</filename> to
212 forward xauth keys between users when calling su:
214 session optional pam_xauth.so
219 <refsect1 id="pam_xauth-implementation">
220 <title>IMPLEMENTATION DETAILS</title>
222 pam_xauth will work <emphasis remap='I'>only</emphasis> if it is
223 used from a setuid application in which the
224 <function>getuid</function>() call returns the id of the user
225 running the application, and for which PAM can supply the name
226 of the account that the user is attempting to assume. The typical
227 application of this type is
229 <refentrytitle>su</refentrytitle><manvolnum>1</manvolnum>
231 The application must call both <function>pam_open_session</function>()
232 and <function>pam_close_session</function>() with the ruid set to the
233 uid of the calling user and the euid set to root, and must have
234 provided as the PAM_USER item the name of the target user.
239 <refentrytitle>xauth</refentrytitle><manvolnum>1</manvolnum>
240 </citerefentry> as the source user to extract the key for $DISPLAY,
241 then calls xauth as the target user to merge the key into the a
242 temporary database and later remove the database.
245 pam_xauth cannot be told to not remove the keys when the session
250 <refsect1 id="pam_lastlog-files">
254 <term><filename>~/.xauth/import</filename></term>
260 <term><filename>~/.xauth/export</filename></term>
269 <refsect1 id='pam_xauth-see_also'>
270 <title>SEE ALSO</title>
273 <refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum>
276 <refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum>
279 <refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum>
284 <refsect1 id='pam_xauth-author'>
285 <title>AUTHOR</title>
287 pam_xauth was written by Nalin Dahyabhai <nalin@redhat.com>,
288 based on original version by
289 Michael K. Johnson <johnsonm@redhat.com>.