CentOS 8.x graphical root access while using wayland

From Notes_Wiki

Home > CentOS > CentOS 8.x > System Administration > Root access > CentOS 8.x graphical root access while using wayland

In X11 it was possible to run graphical applications as root by pointing XAUTHORITY to current users Xauthority file and setting correct DISPLAY. This does not works in wayland. To start applications as root user in wayland use:

  1. Open normal not-root user terminal and check display variable value:
    echo $DISPLAY
  2. From same normal non-root user terminal and give access to display to root using:
    xhost si:localuser:root
  3. Now open a root terminal from using sudo, sudo su -, su -, etc. where you want to launch graphical application. Configure same value for DISPLAY for root as was seen for normal user. For example
    export DISPLAY=:0
    Here :0 is used as example. You need to set value as seen for normal user account
  4. After this you can run commands that need GUI access (eg nautilus) without any problem


Changing display to X11 Classic instead of Wayland

If there is difficulty in using above process after every boot then you can consider shifting from wayland to X11 so that graphical application can be run as root using simple:

su -

same as a few years ago. To do this edit '/etc/gdm/custom.conf and uncomment:

WaylandEnable=false

to disable wayland based login. Also see CentOS 8.x OS auto-login with anydesk auto-startup for seamless remote as these steps also help in disabling wayland based login.

Refer:


Accessing files via root (or admin) privileges from graphical applications

If the goal is only to access files then giving access to display to root is not required. The file absolute path can be prepend with admin:// to make it work over GVFS admin backed. For example as normal not-root user use:

nautilus admin:///root/

To see files in /root without needing full root privileges


Refer:



Home > CentOS > CentOS 8.x > System Administration > Root access > CentOS 8.x graphical root access while using wayland