While attempting to SSH into a host I received the following message from xauth
:
/usr/bin/xauth: timeout in locking authority file /home/sam/.Xauthority
NOTE: I was trying to remote display an X11 GUI via an SSH connection so I needed xauth
to be able to create a $HOME/.Xauthority
file successfully, but as that message was indicating, it was clearly not.
Attempts to run any X11 based apps, such as xeyes
were greeted with this message:
$ xeyes
X11 connection rejected because of wrong authentication.
Error: Can't open display: localhost:10.0
How can I resolve this issue?
Best Answer
Running an
strace
on the remote system wherexauth
is failing will show you what's tripping upxauth
.For example
So
xauth
is attempting to open a file and it already exists. The culprit file is/home/sam/.Xauthority-c
. We can confirm the presence of this file on the remote system:The fix
As it turns out. Those files are lock files for
.Xauthority
, so simply removing them resolves the issue.With the files deleted, exit from the SSH connection and then reconnect. This will allow
xauth
to re-run successfully.Now we're able to run
xauth list
and X11 applications without issue.The GUI
Alternative method to resolve the issue
I came across this post titled: xauth: error in locking authority file .Xauthority [linux, ssh, X11] which mentions the use of
xauth -b
to break any lock files that may be hanging around.xauth
's man page seems to back this up:References