NetBSD-Users archive

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

Re: .Xauthority



tgruhn2%gmail.com@localhost (Todd Gruhn) writes:

>How do I create /root/.Xauthority?

It's a bad idea to run a desktop or X clients as root.


>I use 'xauth' -- but I get nothing useful.

xauth contains cookies that allow you to talk to X servers.
You usually get a cookie when you log in with a display manager like xdm.


The cookie is a random number. When you start the X server, you pass it a
filename with the cookie using the -auth parameter.


xdm generates a cookie and writes it into something like:

/var/db/xdm/authdir/authfiles/A:$DISPLAYNUMBER-$RANDOMSUFFIX

it starts the X server with the appropriate -auth parameter pointing
to that file and when you login, it merges the contents into your
$HOME/.Xauthority.


When you use startx, then startx creates a random cookie and stores it
in $HOME/.serverauth.$$.

It then starts the X server with the appropriate -auth parameter
pointing to that file and also merges the contents into your
$HOME/.Xauthority.


If you want to allow a root process to use your display, then
root can could your cookie like:

xauth -f ~$USER/.Xauthority nlist "$DISPLAY" | xauth nmerge -

However, for such hacks, it's better not to change the default
~root/.Xauthority but to create a secured temporary file and
point the environment variable XAUTHORITY to it.



Home | Main Index | Thread Index | Old Index