[PLUG] Opening X app when su root

Elliott Mitchell ehem at m5p.com
Sat Sep 18 23:48:02 UTC 2004


>From: Rich Shepard <rshepard at appl-ecosys.com>
>    I know there's a way to specify the X host but I can't find it in my saved
> references. Here's the situation:
> 
>    Logged in as a user and running the X Window System. In a virtual terminal
> I 'su -' to root. Now I want to run the OpenOffice.org's 'spadmin' program
> so I can add fonts to what OO.o sees. The X server responds that it cannot
> open the display.

If you've got `sux` installed, that is one option that will take care of
everything for you. Alternatively the `su -m` will work.


>From: Charlie Schluting <charlie at schluting.com>
> 
> chmod 755 ~/.Xauthority
> su -
> XAUTHORITY=~user/.Xauthority spadmin

You don't get an F for suggesting `xhost +`, but you get a D for
suggesting a not quite as insecure thing needed in one environment. Doing
`export XAUTHORITY=<your home dir>/.Xauthority` is my prefered solution
if `sux` is unavailable. The `chmod` is not needed in most places as root
can be root and read the .Xauthority file. In the environment where
you're on NFS and root is not trusted, it is far better to do
`cp -p .Xauthority /tmp/Xauthtmp` as yourself and setting XAUTHORITY as
appropriate, letting root grab it from there, rather than expose your X
tokens to everyone.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \   (    |         EHeM at gremlin.m5p.com PGP 8881EF59         |    )   /
  \_  \   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
    \___\_|_/82 04 A1 3C C7 B1 37 2A*E3 6E 84 DA 97 4C 40 E6\_|_/___/






More information about the PLUG mailing list