Talk:Running GUI applications as root

From ArchWiki


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

xhost + security

Using xhost+ is insecure: Maybe adding:

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

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

Readers are told the same information twice in a row

Under Wayland, it says,

A more versatile though more insecure workaround allows any graphical application to be run as root #Using xhost.

And then immediately following that, again the article says,

A more versatile —though much less secure— workaround is to use xhost to temporarily allow the root user to access the local user's X session.

Pound Hash (talk) 22:36, 22 December 2021 (UTC)Reply[reply]

The instructions for running xhost don't work on Wayland

After running xhost si:localuser:root, an error appears stating, xhost: unable to open display ""

Pound Hash (talk) 22:40, 22 December 2021 (UTC)Reply[reply]