[SunHELP] xhost (cont.)
Doug McLaren
dougmc at frenzy.com
Mon Jan 20 16:32:02 CST 2003
On Thu, Jan 16, 2003 at 01:21:07PM -0500, Markham, Richard wrote:
| Upon trying to automate the xhost entries upon boot within an init
| script
xhost is usually run after logging in, not at startup.
| I find that xhost doesn't make then entries nor does it produce any
| output.
|
| example:
| ~
| #! /bin/sh
| xhost server1 server2 server2
| ~
|
| I threw in a DISPLAY=server:0.0; export DISPLAY on the first line
| and still no go.
That's definately required.
However, if you really want to do this, a few things to consider --
1) your script needs to run after the X server is started.
You can force this by giving it the proper names -- I'm going
to assume that you know how to do this.
2) even root won't have access to the X screen unless you tell it where
the magic cookies are.
You can find the magic cookies by logging in remotely and doing this --
# /usr/ucb/ps -auxwwww | grep Xsun
root 1207 0.1 0.1 928 616 pts/2 S 16:25:28 0:00 grep Xsun
root 340 0.0 1.91782418912 ? S Jan 19 0:00 /usr/openwin/bin/Xsun :0 -nobanner -auth /var/dt/A:0-OvayJa
So the magic cookie file here is /var/dt/A:0-OvayJa. Note that the
file name changes ...
You would then set your XAUTHORITY variable to that value --
XAUTHORITY=`/usr/ucb/ps -auxwwww | grep '[X]sun' | sed 's/.* //'`
export XAUTHORITY
DISPLAY=:0
export DISPLAY
xhost
and even then it wouldn't work, because dtlogin has the X server set to
refuse any new connections. This can be changed, but I don't remember
where ...
Note that xhost hangs here -- that's probably what you're seeing.
You normally run xhost commands in your personal startup scripts --
.xsession or whatever. You could also do it in .cshrc, .login or
.profile, but then it would be run even when you're not using X -- but
that may not bother you.
--
Doug McLaren, dougmc at frenzy.com Yow! Everybody out of the gene pool!
More information about the SunHELP
mailing list