Steps to reproduce:
1) sudo /etc/init.d/xdm stop
2) rm $HOME/.Xauthority
3) sudo /etc/init.d/xdm start
4) login with xdm
5) login with ssh from another machine and try "DISPLAY=:0 xclock"
Expected results:
5) xclock can connect to the X server since it can use ~/.Xauthority
Actual results:
5) xclock fails since ~/.Xauthority does not exist.
More info:
1) strace of xdm filtered with "| grep /.Xauthority | cut --bytes=1-100" shows
2897 stat64("/home/lindi/.Xauthority-c", 0xbeb5eab8) = -1 ENOENT (No such file or directory)
2897 open("/home/lindi/.Xauthority-c", O_WRONLY|O_CREAT|O_EXCL, 0600) = 3
2897 statfs("/home/lindi/.Xauthority-c", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=974515,
2897 link("/home/lindi/.Xauthority-c", "/home/lindi/.Xauthority-l") = 0
2897 unlink("/home/lindi/.Xauthority-n") = -1 ENOENT (No such file or directory)
2897 open("/home/lindi/.Xauthority-n", O_WRONLY|O_CREAT|O_EXCL, 0600) = 3
2897 open("/home/lindi/.Xauthority", O_RDONLY) = -1 ENOENT (No such file or directory)
2897 unlink("/home/lindi/.Xauthority-c") = 0
2897 unlink("/home/lindi/.Xauthority-l") = 0
2897 recvmsg(7, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\360\0\
2897 recvmsg(7, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0
2897 recvmsg(7, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"0\0\0\0
2897 recvmsg(7, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"@\0\0\0
2897 recvmsg(7, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"\24\0\0
so clearly xdm could created ~/.Xauthority if it wanted.
2) XAUTHORITY=/tmp/.XauthcJv6YX is set for children of xdm. This
however does not help with clients that are started from an ssh session.
3) If I login again then ~/.Xauthority is properly created and
XAUTHORITY is no longer set.