how to enable magic cookies on W2K cygwin X11?

David dcorking@yahoo.fr
Wed Feb 19 14:55:00 GMT 2003


Alexander wrote:

> > 1. Stop the tcp listener
> > 

> That means unix sockets must work correctly. If they do you can use the
> -nolisten tcp and :0.0 display

Yes the code I gave works fine (I am definitely a newbie to unix
sockets - I don't even know if they are implemented by cygwin or by
W2K, but thanks to someone it is working right.)


> > 2. Enable the authentication cookies 
> > 
> > However I trawled the man pages about the cookies, and found the X
> > startup scripts in SuSE Linux (which has cookies) to be complex enough
> > that it would be a small project to convert them to cygwin.
> 
> AUTHFILE=`mktemp /tmp/auth.XXXXXX`
> COOKIE=`dd if=/dev/random count=1 | md5sum | cut -f1 -d\ `
> xauth -f $AUTHFILE add :0.0 MIT-MAGIC-COOKIE-1 $COOKIE
> XWin -auth $AUTHFILE
> rm $AUTHFILE

This code worked right first time (thanks Igor for the mcookie
reference too.)

It also made the xauth man page go from opaque to almost lucid.

I needed to add one line before the rm $AUTHFILE
cat $AUTHFILE >>.Xauthority
or the clients could not connect, with the message:

$ xeyes
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

(I guess that in production 
mv $AUTHFILE .Xauthority
or just start with
AUTHFILE=.Xauthority
would be better.)

I think this fixes the openssh warning about fake cookies though I
can't recall how to reproduce it.

> maybe 
> XWin -cookie `dd if=/dev/random count=1 | md5sum | cut -f1 -d\ `
> 
> will work too.

probably not as it seems to me (a real newbie at writing startx
scripts) that the cookie needs to be available to the clients and to
ssh.

David



More information about the Cygwin-xfree mailing list