[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xauth, xhost, and xinit (was Re: GNOME.)



You wrote (in your message from  4)
 > 
 > What I'd ideally like to do is to test adding xauth entries under an
 > xinit session, then seeing if the xhost table can be cleared. But I
 > don't seem to recall how to tell the server of new xauth entries on
 > the fly anymore.
 > 

use xauth(1). 

One solution to have xauth cookies with xinit/startx is to create a
~/.xserverrc that will generate the cokkies for you. Here's is one
(the awk stuff to generate the random number should be replaced to use
a better random generator. But this is very old ~ 10 years). 

---Cut---
#!/bin/sh
# echo "xserverrc $*"
# Create a new .Xauthority file
# generate a random key
HOST=`uname -n`
key=`awk 'BEGIN
{srand();printf("%08x%08x",rand()*4000000000,rand()*4000000000);
}' /dev/null`
# add to auth file. use $key$key to make sure even length
xauth add :0 . $key$key
xauth add ${HOST}:0 . $key$key
if [ -f /usr/X11R6/bin/Xwrapper ]; then
    # Start the wrapper
    exec /usr/X11R6/bin/Xwrapper -ls 0 -auth $HOME/.Xauthority $*
else
    exec /usr/X11R6/bin/X -ls 0 -auth $HOME/.Xauthority $*
fi    
---Cut---
-- 
					Matthieu