Debian Codegraph @

upstream/debian-unstable/man8/pam_xauth.8

raw
1 '\" t
2 .\" Title: pam_xauth
3 .\" Author: [see the "AUTHOR" section]
4 .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
5 .\" Date: 06/29/2025
6 .\" Manual: Linux-PAM Manual
7 .\" Source: Linux-PAM
8 .\" Language: English
9 .\"
10 .TH "PAM_XAUTH" "8" "06/29/2025" "Linux\-PAM" "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_xauth \- PAM module to forward xauth keys between users
32 .SH "SYNOPSIS"
33 .HP \w'\fBpam_xauth\&.so\fR\ 'u
34 \fBpam_xauth\&.so\fR [debug] [xauthpath=\fI/path/to/xauth\fR] [systemuser=\fIUID\fR] [targetuser=\fIUID\fR]
35 .SH "DESCRIPTION"
36 .PP
37 The pam_xauth PAM module is designed to forward xauth keys (sometimes referred to as "cookies") between users\&.
38 .PP
39 Without pam_xauth, when xauth is enabled and a user uses the
40 \fBsu\fR(1)
41 command to assume another user\*(Aqs privileges, that user is no longer able to access the original user\*(Aqs X display because the new user does not have the key needed to access the display\&. pam_xauth solves the problem by forwarding the key from the user running su (the source user) to the user whose identity the source user is assuming (the target user) when the session is created, and destroying the key when the session is torn down\&.
42 .PP
43 This means, for example, that when you run
44 \fBsu\fR(1)
45 from an xterm session, you will be able to run X programs without explicitly dealing with the
46 \fBxauth\fR(1)
47 xauth command or ~/\&.Xauthority files\&.
48 .PP
49 pam_xauth will only forward keys if xauth can list a key connected to the $DISPLAY environment variable\&.
50 .PP
51 Primitive access control is provided by
52 ~/\&.xauth/export
53 in the invoking user\*(Aqs home directory and
54 ~/\&.xauth/import
55 in the target user\*(Aqs home directory\&.
56 .PP
57 If a user has a
58 ~/\&.xauth/import
59 file, the user will only receive cookies from users listed in the file\&. If there is no
60 ~/\&.xauth/import
61 file, the user will accept cookies from any other user\&.
62 .PP
63 If a user has a
64 \&.xauth/export
65 file, the user will only forward cookies to users listed in the file\&. If there is no
66 ~/\&.xauth/export
67 file, and the invoking user is not
68 \fBroot\fR, the user will forward cookies to any other user\&. If there is no
69 ~/\&.xauth/export
70 file, and the invoking user is
71 \fBroot\fR, the user will
72 \fInot\fR
73 forward cookies to other users\&.
74 .PP
75 Both the import and export files support wildcards (such as
76 \fI*\fR)\&. Both the import and export files can be empty, signifying that no users are allowed\&.
77 .SH "OPTIONS"
78 .PP
79 debug
80 .RS 4
81 Print debug information\&.
82 .RE
83 .PP
84 xauthpath=/path/to/xauth
85 .RS 4
86 Specify the path the xauth program (it is expected in
87 /usr/X11R6/bin/xauth,
88 /usr/bin/xauth, or
89 /usr/bin/X11/xauth
90 by default)\&.
91 .RE
92 .PP
93 systemuser=UID
94 .RS 4
95 Specify the highest UID which will be assumed to belong to a "system" user\&. pam_xauth will refuse to forward credentials to users with UID less than or equal to this number, except for root and the "targetuser", if specified\&.
96 .RE
97 .PP
98 targetuser=UID
99 .RS 4
100 Specify a single target UID which is exempt from the systemuser check\&.
101 .RE
102 .SH "MODULE TYPES PROVIDED"
103 .PP
104 Only the
105 \fBsession\fR
106 type is provided\&.
107 .SH "RETURN VALUES"
108 .PP
109 PAM_BUF_ERR
110 .RS 4
111 Memory buffer error\&.
112 .RE
113 .PP
114 PAM_PERM_DENIED
115 .RS 4
116 Permission denied by import/export file\&.
117 .RE
118 .PP
119 PAM_SESSION_ERR
120 .RS 4
121 Cannot determine user name, UID or access users home directory\&.
122 .RE
123 .PP
124 PAM_SUCCESS
125 .RS 4
126 Success\&.
127 .RE
128 .PP
129 PAM_USER_UNKNOWN
130 .RS 4
131 User not known\&.
132 .RE
133 .SH "EXAMPLES"
134 .PP
135 Add the following line to
136 /etc/pam\&.d/su
137 to forward xauth keys between users when calling su:
138 .sp
139 .if n \{\
140 .RS 4
141 .\}
142 .nf
143 session optional pam_xauth\&.so
144
145 .fi
146 .if n \{\
147 .RE
148 .\}
149 .sp
150 .SH "IMPLEMENTATION DETAILS"
151 .PP
152 pam_xauth will work
153 \fIonly\fR
154 if it is used from a setuid application in which the
155 \fBgetuid\fR() call returns the id of the user running the application, and for which PAM can supply the name of the account that the user is attempting to assume\&. The typical application of this type is
156 \fBsu\fR(1)\&. The application must call both
157 \fBpam_open_session\fR() and
158 \fBpam_close_session\fR() with the ruid set to the uid of the calling user and the euid set to root, and must have provided as the PAM_USER item the name of the target user\&.
159 .PP
160 pam_xauth calls
161 \fBxauth\fR(1)
162 as the source user to extract the key for $DISPLAY, then calls xauth as the target user to merge the key into the a temporary database and later remove the database\&.
163 .PP
164 pam_xauth cannot be told to not remove the keys when the session is closed\&.
165 .SH "FILES"
166 .PP
167 ~/\&.xauth/import
168 .RS 4
169 XXX
170 .RE
171 .PP
172 ~/\&.xauth/export
173 .RS 4
174 XXX
175 .RE
176 .SH "SEE ALSO"
177 .PP
178 \fBpam.conf\fR(5),
179 \fBpam.d\fR(5),
180 \fBpam\fR(7)
181 .SH "AUTHOR"
182 .PP
183 pam_xauth was written by Nalin Dahyabhai <nalin@redhat\&.com>, based on original version by Michael K\&. Johnson <johnsonm@redhat\&.com>\&.