1PAM_XAUTH(8) Linux-PAM Manual PAM_XAUTH(8)
2
3
4
6 pam_xauth - PAM module to forward xauth keys between users
7
9 pam_xauth.so [debug] [xauthpath=/path/to/xauth] [systemuser=UID]
10 [targetuser=UID]
11
13 The pam_xauth PAM module is designed to forward xauth keys (sometimes
14 referred to as "cookies") between users.
15
16 Without pam_xauth, when xauth is enabled and a user uses the su(1)
17 command to assume another user's privileges, that user is no longer
18 able to access the original user's X display because the new user does
19 not have the key needed to access the display. pam_xauth solves the
20 problem by forwarding the key from the user running su (the source
21 user) to the user whose identity the source user is assuming (the
22 target user) when the session is created, and destroying the key when
23 the session is torn down.
24
25 This means, for example, that when you run su(1) from an xterm session,
26 you will be able to run X programs without explicitly dealing with the
27 xauth(1) xauth command or ~/.Xauthority files.
28
29 pam_xauth will only forward keys if xauth can list a key connected to
30 the $DISPLAY environment variable.
31
32 Primitive access control is provided by ~/.xauth/export in the invoking
33 user's home directory and ~/.xauth/import in the target user's home
34 directory.
35
36 If a user has a ~/.xauth/import file, the user will only receive
37 cookies from users listed in the file. If there is no ~/.xauth/import
38 file, the user will accept cookies from any other user.
39
40 If a user has a .xauth/export file, the user will only forward cookies
41 to users listed in the file. If there is no ~/.xauth/export file, and
42 the invoking user is not root, the user will forward cookies to any
43 other user. If there is no ~/.xauth/export file, and the invoking user
44 is root, the user will not forward cookies to other users.
45
46 Both the import and export files support wildcards (such as *). Both
47 the import and export files can be empty, signifying that no users are
48 allowed.
49
51 debug
52 Print debug information.
53
54 xauthpath=/path/to/xauth
55 Specify the path the xauth program (it is expected in
56 /usr/X11R6/bin/xauth, /usr/bin/xauth, or /usr/bin/X11/xauth by
57 default).
58
59 systemuser=UID
60 Specify the highest UID which will be assumed to belong to a
61 "system" user. pam_xauth will refuse to forward credentials to
62 users with UID less than or equal to this number, except for root
63 and the "targetuser", if specified.
64
65 targetuser=UID
66 Specify a single target UID which is exempt from the systemuser
67 check.
68
70 Only the session type is provided.
71
73 PAM_BUF_ERR
74 Memory buffer error.
75
76 PAM_PERM_DENIED
77 Permission denied by import/export file.
78
79 PAM_SESSION_ERR
80 Cannot determine user name, UID or access users home directory.
81
82 PAM_SUCCESS
83 Success.
84
85 PAM_USER_UNKNOWN
86 User not known.
87
89 Add the following line to /etc/pam.d/su to forward xauth keys between
90 users when calling su:
91
92 session optional pam_xauth.so
93
94
95
97 pam_xauth will work only if it is used from a setuid application in
98 which the getuid() call returns the id of the user running the
99 application, and for which PAM can supply the name of the account that
100 the user is attempting to assume. The typical application of this type
101 is su(1). The application must call both pam_open_session() and
102 pam_close_session() with the ruid set to the uid of the calling user
103 and the euid set to root, and must have provided as the PAM_USER item
104 the name of the target user.
105
106 pam_xauth calls xauth(1) as the source user to extract the key for
107 $DISPLAY, then calls xauth as the target user to merge the key into the
108 a temporary database and later remove the database.
109
110 pam_xauth cannot be told to not remove the keys when the session is
111 closed.
112
114 ~/.xauth/import
115 XXX
116
117 ~/.xauth/export
118 XXX
119
121 pam.conf(5), pam.d(5), pam(8)
122
124 pam_xauth was written by Nalin Dahyabhai <nalin@redhat.com>, based on
125 original version by Michael K. Johnson <johnsonm@redhat.com>.
126
127
128
129Linux-PAM Manual 05/18/2017 PAM_XAUTH(8)