[Sussex] Newcomer

Steve Dobson steve at dobson.org
Tue Sep 20 15:24:28 UTC 2005


John

On Tue, Sep 20, 2005 at 11:50:25AM +0100, John D. wrote:
> Steve Dobson wrote:
> >If you're going to be using a graphical program then before using "su -"
> >one needs to first run the command "xhost +".  This allows any user to
> >put a graphical window upon the user's display.  If you don't use "su -"
> >but just "su" then the user's environment is still in place and his
> >graphic authority is being used.
> >
> >Once you have "su -"ed then you also need to issue the command:
> >  export DISPLAY=:0.0
> >in order for the graphics programs to know where to put their displays.
> >
> I wondered how that was done - because I have a rubbish memory for 
> commands and the like, except when I try the above I just get
> 
> john at localhost ~ $ xhost +
> access control disabled, clients can connect from any host
> john at localhost ~ $ su -
> Password:
> localhost ~ # xhost +
> xhost:  unable to open display ""
> localhost ~ #
> 
> Correct me if I've understood what you posted wrongly Steve, if I do the 
> xhost + command, when I then do the su- (or is it suspace-???) it should 
> allow me to open a graphical root window (like I'd get if I was actually 
> logged in graphically as root) ???

The xhost(1) you ran before you "su -" to root worked fine because at that
time the DISPLAY was set.  Do an "echo $DISPLAY" before you "su" and you
will find that DISPLAY has a value.

After you "su -" it will not have a value as the "-" flag means destory
the orginal user's environment and DISPLAY is part of that environment.

xhost, being an X11 program, uses DISPLAY to tell it which X11 display
to connect to.  You'll need to do the 
  export DISPLAY=:0.0
as I stated before to get it (and all other X11 client programs) to work.

Steve
-- 
BOFH excuse #296:

The hardware bus needs a new token.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.lug.org.uk/pipermail/sussex/attachments/20050920/7d8911e5/attachment.pgp 


More information about the Sussex mailing list