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

Re: Re^2: X not allowed by user other than root



On Sat, 27 Apr 1996, Susan G. Kleinmann wrote:

> (I also tried the alternative suggestion, viz., to set up a dummy interface;
> I then checked that it was 'up' using /sbin/route.  However, having dummy up
> did not solve the problem -- only setting DISPLAY to :0.0 solved the problem.)

I'm quite surprised that this didn't work. Could you describe how you did it?

> a) is there some reason that setting DISPLAY to :0.0 is undesirable?  This
>    seemed like the most direct solution to the problem, so I wonder why
>    it wasn't suggested as the best solution.

There is no particular reason not to set DISPLAY to :0.0.  When DISPLAY 
is set to :0.0 the X clients contact the X server using a Unix-domain 
socket, /tmp/.X11-unix/X0 in the case of display 0, /tmp/.X11-unix/X1 in 
the case of display 1, etc.

When you run X clients on remote hosts you have to make sure that the
DISPLAY variable on those hosts points back to your display, otherwise the
clients will try to contact display 0 on the machines that they are
running on. I use a (nasty hack) little shell script to do this (which I
wrote years ago when I didn't know how to program the shell very well and
haven't changed since): 

--- start included nasty hack ---
#!/bin/bash
#
# Start a login xterm on a remote machine
#
# Assume that the name of the remote machine is the first argument
# Assume that DISPLAY is in our environment

# Check our command line parameters

if [ "$#" = "1" ]; then
rcommand="xterm -ls +ut -name $1"
else
rcommand=$2
fi

# Fix DISPLAY so that it's got the hostname in it...

if [ "${DISPLAY}" = ":0.0" ]; then
DISPLAY=$(hostname -f):0.0
fi

if [ "$DISPLAY" = ":1.0" ]; then
DISPLAY=$(hostname -f):1.0
fi

# What's the path of the X utils on the remote machine?  (A nasty hack)

XP=/usr/bin/X11

# Special cases:
case $1 in
cus.cam.ac.uk) XP=/applic/X11R5/bin ;;
thor.cam.ac.uk) XP=/opt/X11R5/bin ;;
esac

# Export the authorization entry to the remote machine...
if [ ! -f ~/.xremote/$1 ]; then
  xauth -q extract - ${DISPLAY} | rsh $1 "${XP}/xauth merge -"
  date >~/.xremote/$1
fi

# Start up an xterm on the remote machine...
rsh -n $1 "bash -c 'export DISPLAY=${DISPLAY} ; ${XP}/${rcommand} </dev/null &>/dev/null &'" &

# Hopefully that's the end.
--- end included nasty hack ---

I know it's ugly, and not terribly general. It works for me. Ian Jackson 
has a better system, which is considerably more complicated than mine. He 
might be persuaded to post it...

> b) doesn't that fact that this problem has only been apparent recently 
>    imply that xinit somehow recently got broken (and thus needs to be fixed)?
>    i.e., shouldn't I file a bug report?

Could you try providing a display number explicitly, as in

xinit -- :0
or
xinit -- :1

as this seems work properly on my machine?

Steve Early
sde1000@cam.ac.uk


Reply to: