I ran into this problem and saw lots of solutions but none of them worked for me. I did all sorts of tricks including running strace on xauth. The problem turned out to be a line in my .bashrc file. I have a customized .bashrc file that I carry around with me and put on every server I have. Unfortunately there is one line in it that shouldn't be there. It looks like:
export XAUTHORITY=/home/jim/.Xauthority
And that works fine if I am running under the user 'jim' on the server, but that's not always the case. So I changed that line to reflect the user that is running on the server and all is well.
Hope this helps someone else.