pam_xauth.8 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. '\" t
  2. .\" Title: pam_xauth
  3. .\" Author: [see the "AUTHOR" section]
  4. .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
  5. .\" Date: 09/03/2021
  6. .\" Manual: Linux-PAM Manual
  7. .\" Source: Linux-PAM Manual
  8. .\" Language: English
  9. .\"
  10. .TH "PAM_XAUTH" "8" "09/03/2021" "Linux-PAM Manual" "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. \fBdebug\fR
  80. .RS 4
  81. Print debug information\&.
  82. .RE
  83. .PP
  84. \fBxauthpath=\fR\fB\fI/path/to/xauth\fR\fR
  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. \fBsystemuser=\fR\fB\fIUID\fR\fR
  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. \fBtargetuser=\fR\fB\fIUID\fR\fR
  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. .fi
  145. .if n \{\
  146. .RE
  147. .\}
  148. .sp
  149. .SH "IMPLEMENTATION DETAILS"
  150. .PP
  151. pam_xauth will work
  152. \fIonly\fR
  153. if it is used from a setuid application in which the
  154. \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
  155. \fBsu\fR(1)\&. The application must call both
  156. \fBpam_open_session\fR() and
  157. \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\&.
  158. .PP
  159. pam_xauth calls
  160. \fBxauth\fR(1)
  161. 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\&.
  162. .PP
  163. pam_xauth cannot be told to not remove the keys when the session is closed\&.
  164. .SH "FILES"
  165. .PP
  166. ~/\&.xauth/import
  167. .RS 4
  168. XXX
  169. .RE
  170. .PP
  171. ~/\&.xauth/export
  172. .RS 4
  173. XXX
  174. .RE
  175. .SH "SEE ALSO"
  176. .PP
  177. \fBpam.conf\fR(5),
  178. \fBpam.d\fR(5),
  179. \fBpam\fR(8)
  180. .SH "AUTHOR"
  181. .PP
  182. pam_xauth was written by Nalin Dahyabhai <nalin@redhat\&.com>, based on original version by Michael K\&. Johnson <johnsonm@redhat\&.com>\&.