Talk:Running X apps as root

From ArchWiki
Jump to: navigation, search

/etc/X0.hosts

What about /etc/X0.hosts file ? It's descibed in Xserver manual, in section "GRANTING ACCESS".

xhost + security

Using xhost+ is insecure: http://www.ocf.berkeley.edu/help/X_Windows_Env_HTML/security.html Maybe adding:

HOST=`hostname`
XAUTH=`ps -C X f|sed -n 's/.*-auth *//p'`
XKEY=`xauth -f ${XAUTH} list | awk '{print $3}'`

xauth add ${HOST}/unix:0 MIT-MAGIC-COOKIE-1 ${XKEY}
xauth add ${HOST}:0 MIT-MAGIC-COOKIE-1 ${XKEY}

unset HOST
unset XAUTH
unset XKEY

to /root/.bashrc is a better solution ?

OK ... one more solution:
# xhost +SI:localuser:root
localuser:root being added to access control list
or saving it in a config file:
# cat /etc/X0.hosts
si:localuser:root

DISPLAY not set

I have problem with DISPLAY setting missing when using gksu. Even

gksu export DISPLAY=:0 gedit

won't work. I finally managed with

gksu env DISPLAY=:0 gedit