Difference between revisions of "CentOS 8.x graphical root access while using wayland"

From Notes_Wiki
(Created page with "<yambe:breadcrumb self="Graphical root access while using wayland">CentOS 8.x root access|root access</yambe:breadcrumb> =CentOS 8.x graphical root access while using wayland=...")
 
m
Line 3: Line 3:


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:
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:
# Open '''normal non-root user''' terminal and give access to display to root using:
# Open '''normal not-root user''' terminal and check display variable value:
#:<pre>
#:: echo $DISPLAY 
#:</pre>
# From same '''normal non-root user''' terminal and give access to display to root using:
#:<pre>
#:<pre>
#:: xhost si:localuser:root
#:: xhost si:localuser:root
#:</pre>
#:</pre>
# 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
#:<pre>
#:: export DISPLAY=:0
#:</pre>
#: Here :0 is used as example.  You need to set value as seen for normal user account
# 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:
<pre>
su -
</pre>
same as a few years ago.  To do this edit '<tt>/etc/gdm/custom.conf</tt> and '''uncomment''':
<pre>
WaylandEnable=false
</pre>
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:
* https://unix.stackexchange.com/questions/336219/gnome-defaults-to-wayland-how-can-i-go-to-back-to-x11#336227


After this you can open root terminal using sudo, sudo su -, su -, etc. and run commands that need GUI access (eg nautilus) without any problem





Revision as of 09:35, 2 August 2021

<yambe:breadcrumb self="Graphical root access while using wayland">CentOS 8.x root access|root access</yambe:breadcrumb>

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:



<yambe:breadcrumb self="Graphical root access while using wayland">CentOS 8.x root access|root access</yambe:breadcrumb>