I am using X11 over the secure shell with the "trusted forwarding" flag, i.e.using trusted forwarding with ssh -Y

Today I have been receiving the following error:

/usr/bin/xauth:  error in locking authority file /home/users/USERNAME/.Xauthority

To actually try to use X11 with an application, I get the error

X11 connection rejected because of wrong authentication

It's difficult to find exact documentation regarding what is going on here. Any advice?


For future users: when this happens, it appears either (A) you are out of disk space or (B) the file permissions are wrong.

It looks like I had a combination of the two. Issue resolved.

  • What is the user, group and permissions on the directory /home/users/USERNAME and the file /home/users/USERNAME/.Xauthority (on the remote host)? – Murray Jensen Nov 18 '15 at 14:29
  • @MurrayJensen I think I see where you're coming from It appears /home/users/USERNAME/.Xauthority doesn't exist, or is not writable by USERNAME. How do I change this? – ShanZhengYang Nov 18 '15 at 14:44
  • Presumably /home/users/USERNAME is the home directory for user USERNAME so if it is not owned by them you are going to have a lot of other problems (which is the only way you could not create the file if it didn't exist) ... my guess is that the user's .Xauthority file will be owned by root - I vaguely recall a bug somewhere (in openssh??) that causes this ownership problem but can't remember the details ... just remove the .Xauthority file for that user (on the remote host) – Murray Jensen Nov 18 '15 at 14:57
  • @MurrayJensen I deleted the .Xauthority file. Unfortunately, I get a similar error. – ShanZhengYang Nov 18 '15 at 15:03
  • 1
    sorry, not sure how to fix this ... try creating an empty .Xauthority file owned by the user after removing the one owned by root. – Murray Jensen Nov 18 '15 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.