How to fix: timeout in locking authority file /home//.Xauthority (2018)

If you are reading this, then the chance is big that you are getting the “timeout in locking authority file /home/<user>/.Xauthority” error. Below we have written out how you can solve this issue.

But before you start, did you try the following command?

strace xauth list

The command above will show what is the problem of xauth starting correctly. Make sure to read the log and google on the items.

Lets start with the first one. We are going to check if there are locked .Xauthority files in the /home/<user>/ folder.

cd /home/<user>
ls -l | grep .Xauth*

If it is correct, you should not see any locked .Xauthority files, if you do see them, you can perform the following command in the /home/<user>/ folder:

rm -fr .Xauthority-*

Once you have performed the above, reset the SSH connection, and check if you get the same error.

If the error is still there, we can continue to the next step: 

cd /home/user
ls -a -lh
chown <user>:<user> .Xau*

Disconnect from SSH and reconnect, check if you get the same error. If you still get the error, we are going to try the following:

cd /home/machine
mv .Xauthority .Xauthority.old
touch .Xauthority
chown machine:machine .Xauthority

If chown is giving an error, make sure that the file is writable, by performing the following command:

chmod +x .Xauthority

Disconnect from SSH and reconnect, if the error is still there, we can try the following:

xauth -b

The command above will break any locked file.

Sources used:

  • https://unix.stackexchange.com/questions/215558/why-am-i-getting-this-message-from-xauth-timeout-in-locking-authority-file-ho
  • https://askubuntu.com/questions/165921/error-on-boot-12-04/166115#166115
  • My own x11 environment lol =)