10 Apr 2010 mones   » (Journeyer)

xauth magic

While trying to launch claws-mail in my remote ssh-forwarded display I got an:
X11 connection rejected because of wrong authentication error message.
I realized then that while DISPLAY was configured correctly to point localhost:10.0 I was using another user in the screen session, not the one used to ssh in. After some googling for the message seems the usual culprits for this were low disc space (!) and disabled X11 forwarding, which were not my case. There were mentions to ~/.Xauthority permissions, but you don't have such file when you su to another user. So xauth came to my rescue: on the user which logs in you can list authorizations:

$ xauth list
busgosu/unix:0  MIT-MAGIC-COOKIE-1  
localhost.localdomain/unix:0  MIT-MAGIC-COOKIE-1  
busgosu/unix:10  MIT-MAGIC-COOKIE-1  

And in the user you su-ed to, and which doesn't have the file:
$ xauth
xauth:  creating new authority file /home/otheruser/.Xauthority
Using authority file /home/otheruser/.Xauthority
xauth> add busgosu/unix:10  MIT-MAGIC-COOKIE-1  
xauth> exit
Writing authority file /home/otheruser/.Xauthority
$

And you're done, with the same authorization now X11 forwarding works for the other user too :-).

Syndicated 2009-12-28 11:14:45 from Ricardo Mones

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!