Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] [Solved] Open as root GUI applications  (Read 1665 times)

Offline Mte90

  • User
  • Posts: 221
  • KDE & Debian lover
    • http://www.mte90.net
[EN] Re: Open as root GUI applications
« Reply #15 on: 2024/01/24, 11:00:54 »
In the meantime I reboot and tried from root now that there is the symlink and I am getting the usual error, maybe the file needs to be symlinked to a different one?

Someone has ideas on how to get a useful log?

Offline ro_sid

  • User
  • Posts: 223
Re: Open as root GUI applications
« Reply #16 on: 2024/01/24, 11:48:53 »
Uhm on the root user I see the same file that is a symlink:
Code: [Select]
lrwxrwxrwx      -         - root root  13 lug  2020  .Xauthority -> /var/run/xauth/*
I have reflected a little bit over that strange entry, and do think, I now do understand its meaning. I am not sure, the construction is valid, because I have never seen a symlink with a wildcard, yet, i.e. pointing to several files.
As I reported previously, "root" gets/can get several .xauth... files simultaneously, although with the same content (MIT-COOKIE). Now, ".Xauthority -> /var/run/xauth/*" could try to make .Xauthority point to all files in /var/run/xauth. As written, I do not know, if this is a valid construct. Anyways, at least one file has to appear in /var/run/xauth. So you should first check, (from) where your(!) xauth-files are generated, when they do not appear under (/var)/run/xauth [the var is unnecessary after the last filesystem rework (some very bad moves, in my opinion)].
You can check, where "your" xauth-files appear with (e.g.) "ps -aef | fgrep X". It will show you the X "session" command and the path to the "xauth"s. Then you might recreate the .Xauthority symlink to that path, including the "*".
In my view this should give you a ticket to access the X-Display.
As written before, I see it vital, that the target file (not the symlink!) may be read by its user, only.

Edit: regarding the logs, you can have a view at /var/log/Xorg.log.n for the X11 setup, but I doubt, you find something useful for your case, there. Then you can have a look into the .xerrors file in the respective users home(s). Finally I would have a look at /var/log/syslog, but with systemd this may no longer exist, so someone else has to tell you, how to achieve this with "journalctl" [also a step back, to have a binary file as a logfile, in my opinion - how do you look it up from a "live" system?].
« Last Edit: 2024/01/24, 11:57:28 by ro_sid »

Offline hendrikL

  • Administrator
  • User
  • *****
  • Gravatar
  • Posts: 933
Re: Open as root GUI applications
« Reply #17 on: 2024/01/24, 13:48:12 »
https://wiki.archlinux.org/title/Running_GUI_applications_as_root#Circumvent_running_graphical_applications_as_root

Maybe you find something useful, but read the warning!

What does "xauth list" telling?

Something like that?
Code: [Select]
:~$ xauth list
localhost.localdomain/unix:0  MIT-MAGIC-COOKIE-1  40cc267484a15405a088d742897e6611
#ffff##:0  MIT-MAGIC-COOKIE-1  40cc267484a15405a088d742897e6611




Offline edlin

  • User
  • Posts: 542
Re: Open as root GUI applications
« Reply #18 on: 2024/01/24, 13:54:08 »
A few additions:
- Under KDE/Plasma (X11) you can find xauth_xxxxxx under /run/sddm/, for example /run/sddm/xauth_sOZLbM
- .Xauthority is only necessary if the environment variable XAUTHORITY is not defined.
Code: [Select]
env |grep XAUTH
XAUTHORITY=/tmp/xauth_VlcQly

man xauth
https://www.ibm.com/docs/en/aix/7.3?topic=x-xauth-command

edlin
Der Kluge lernt aus allem und von jedem,
der Normale aus seinen Erfahrungen
und der Dumme weiß alles besser.

Sokrates

Offline Mte90

  • User
  • Posts: 221
  • KDE & Debian lover
    • http://www.mte90.net
Re: Open as root GUI applications
« Reply #19 on: 2024/01/24, 14:40:02 »
Code: [Select]
mte90  /  tmp  ps -aef | fgrep X
root        1426    1384  3 10:37 tty2     00:07:22 /usr/lib/xorg/Xorg -dpi 0 -background none -seat seat0 vt2 -auth /run/sddm/xauth_ciVfgQ -noreset -displayfd 16
mte90      58985   41226  0 14:34 pts/3    00:00:00 grep -F X

Root user doesn't have .xsession-errors file but mine user yes but is just a list of environment variables.

Code: [Select]
mte90  /  tmp  xauth list
KITT/unix:0  MIT-MAGIC-COOKIE-1  01561c29aaed3bd33c6f6e42b8b8984c
#ffff##:0  MIT-MAGIC-COOKIE-1  01561c29aaed3bd33c6f6e42b8b8984c

as root:

Code: [Select]
 xauth list
KITT/unix:1  MIT-MAGIC-COOKIE-1  b47b2bb365dc1e8a455f10a0c721817c
kitt/unix:0  MIT-MAGIC-COOKIE-1  29b63642b81aa11e96b40bbfcabd6bbb
KITT/unix:0  MIT-MAGIC-COOKIE-1  75a81ff9835158d2140749d24e7bcd66

Code: [Select]
mte90  /  tmp  env |grep XAUTH
XAUTHORITY=/tmp/xauth_eHJBEs

Seems that I had this in my root bashrc:

env |grep XAUTH
XAUTHORITY=/home/mte90/.Xauthority

Removed and now the root user is able to run GUIs.