After upgrading to OS X 10.6.3 I started having some really strange issues when trying to log into Linux or FreeBSD boxes.  When I would run the command it would hang for about a minute or two after I typed in the password. When running in verbose mode I saw it was hanging at the xauth command.

$ ssh -vvvY tst-srv
........................
tstuser@tst-srv's password:
debug3: packet_send2: adding 48 (len 62 padlen 18 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: x11_get_proto: /usr/X11R6/bin/xauth  list /tmp/launch-n3zZuC/org.x:0 2>/dev/null

Looking around the internet I found very little about this problem.  Most things I found had to do with people playing around with DNS resolution.  I was sure this was not the case for me because I have all the machines I access regularly hard-coded in my /etc/hosts to prevent dealing with DNS.

After a while I came across this post on one of the Apple message boards.  Looks like after the 10.6.3 upgrade something changed with xauth.  Well, to be more precise, looks like something changed with the entire Xorg toolset.

When I try to check which file xauth is using I am seeing something like this:

$ echo $DISPLAY
/tmp/launch-gLkgC0/org.x:0

What seems to be causing some problems is the “org.x” part. Seems like xauth is trying to do is resolve “org.x”, timing out and then moving right along.  This is horrible and I have no clue how this made it out into a GA release.

Well, this seems easy enough to fix though once I found the solution.  I am running BASH on my system so this is going to be BASH specific.  All I did was add the following to my ~/.profile file.

# Fix the X timeout problem
DISPLAYLOC=`echo $DISPLAY | sed -e 's/org.x:0//'`
if [ ! -e $DISPLAYLOC":0" ]; then
	ln -s $DISPLAYLOC"org.x:0" $DISPLAYLOC":0"
fi
DISPLAY=$DISPLAYLOC":0"

What this is doing is creating a symlink to the file that should already exist but has the wonky name to it and making it better formatted. After that it is reseting the DISPLAY variable to something without “org.x”.

I had to close the shell and reopen it to take the new settings the now the timeout is gone!