The pam_xauthority module securely creates Xauthority files in a temporary directory other than the user’s home directory, for use when home directories are on network filesystems. It does this by using mkstemp() and then setting the XAUTHORITY environment variable appropriately.

One uses pam_xauthority by adding the line

session    optional

to /etc/pam.d/common-session.

It supports two options: debug (for debugging output) and an option dir controlling the directory where it creates xauthority files (the default is /tmp). So, the pam_xauthority session line might look like:

session    optional debug dir=/var/tmp

pam_xauthority is part of the Debian-Athena distribution. You can also browse and download the source. The current release, pam_xauthority 0.5.3, was released on July 21, 2007. Note that the pam_mktemp module generalizes pam_xauthority, so that there are unlikely to be any future releases of pam_xauthority.