Jump to content

Talk:Running GUI applications as root

From ArchWiki
Latest comment: 30 September by D3layar in topic discoverability and structure

/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

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

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

discoverability and structure

I use Arch since 2008 and never knew this page and neither gvfs gio admin:// which seems to exist since about 2016. This page should be linked to at the end of the installation guide! The structure of this page should be changed into two toplevel blocks first "1 Running graphical application as user while accessing files as root" and subsequently "2 Running graphical applications as root (and accessing files as root)" and the ugly red warning should come under the second title. Then 2.1 for Xorg 2.2 wayland 2.3 etc Also the name of the page itself is questionnable. Practically no one wants to actually run a GUI as root, but wants to access priviledged files. So this page should come after the install guide as something more like "Edit system files from a desktop environment"

--D3layar (talk) 02:30, 30 September 2025 (UTC)Reply