Cheat sheets

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

Share this with people that should know this:

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:

  • My own x11 environment lol =)


Share this with people that should know this: