Hi Derek --

You asked:
> How is the X authorization set up in Debian?

Lukas Nellen provided a nice answer to this a while ago.  I'm just repeating
it here:

> 
> I am running xdm and I discovered that only the login user can
> start an X window. There are 2 situations when I cannot start a 
> X window:
> (1) when I try to start a window after 'su' to root. I discovered this
>     can be fixed if I do 'xhost +mymachinename'. How to this automatically?
>     A line in Xaccess or some /etc/X11/X???.hosts file?
Below is a solution for users of startx.  If you want to run xdm, then
you'll have to replace the 2nd file mentioned with an appropriate file
for xdm (It's whatever file starts up xdm.)

Create 2 files in /usr/local/bin.

File #1 is called "mkcookie".  Here are its contents:
-------Start of mkcookie ------ cut here-------------------------
#!/bin/sh
# create a magic cookie for X11
# From Lukas Nellen <[EMAIL PROTECTED]>

if [ -z "$1" ]; then
    display=0
else
    display=$1
fi

cookie=`ps auxwwee | md5sum`
xauth add :$display MIT-MAGIC-COOKIE-1 $cookie
xauth add `hostname`:$display MIT-MAGIC-COOKIE-1 $cookie
-------End   of mkcookie ------ cut here-------------------------

File #2 is called "startx".  Here are its contents:
-------Start of startx  ------ cut here-------------------------
#!/bin/sh
# From Lukas Nellen <[EMAIL PROTECTED]>
mkcookie
exec xinit -- -auth $HOME/.Xauthority
-------End   of startx  ------ cut here-------------------------

If you're trying to execute an X command as root from a display owned by
user, then as root execute these commands:

ln -s /home/user/.Xauthority ~/.Xauthority
export DISPLAY=`hostname`:0    <== this is a bash-ism; you may want 
                                   sentenv for csh.

> (2) after establishing a PPP connection to my service provider and 
>     changing my hostname (I have only a dynamic IP address from my ISP).
>     Here I suppose there is nothing I can do except do xhost from my ip-up
>     script after fixing (1).

Guy Maor suggested the following addition to your /etc/ppp/ip-up script:

--cut--
#
# edit /etc/hosts
#
myip=$4
myname=`nslookup $myip | sed -n 's/Name: *\(.*\)/\1/p'`
sed -e "/femto/s/.*/$myip       $myname femto/" /etc/hosts > /tmp/hosts
mv -f /tmp/hosts /etc/hosts
chmod +r /etc/hosts
--cut--

Note that the big space on the sed line is a tab, but it's just for
readability.

Then put your machine's name on the /etc/hosts the first time with a
bogus address.  Don't put it in the loopback line; and replace femto
aboce with whatever your machine's name is.  My /etc/hosts looks like
this for example:
127.0.0.1       loopback localhost
128.83.111.163  slip-33-3.ots.utexas.edu femto
128.83.204.246  telesys1.ots.utexas.edu telesys1 telesys
128.83.185.40   ns1.utexas.edu
128.83.185.41   ns2.utexas.edu


============================================================
Hope that helps.
Susan Kleinmann

Reply via email to