[SunHELP] xhost (cont.): automating access control
Thu Feb 6 09:31:21 CST 2003
I finally resolved this by giving root access to the display in
/etc/X0.hosts first then ran the following from within /etc/rc3.d
XAUTHORITY=`/usr/ucb/ps -auxwwww | grep '[X]sun' | sed 's/.* //'`
export XAUTHORITY
DISPLAY=:0
export DISPLAY
xhost <host list>
Thanks Doug.
-----Original Message-----
From: Markham, Richard [mailto:RMarkham at hafeleamericas.com]
Sent: Wednesday, February 05, 2003 12:33 PM
To: Sunhelp (sunhelp at sunhelp.org)
Subject: RE: [SunHELP] xhost (cont.)
Doug or anyone on the list.
How can I run scripts after the X server has started?
| 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.
-----Original Message-----
From: Doug McLaren [mailto:dougmc at frenzy.com]
Sent: Monday, January 20, 2003 5:32 PM
To: Markham, Richard
Cc: Sunhelp (sunhelp at sunhelp.org)
Subject: Re: [SunHELP] xhost (cont.)
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 --
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!
_______________________________________________
SunHELP maillist - SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp
More information about the SunHELP
mailing list