Thunar: open as root

I would like to upgrade the user-defined Aktioon “Open as root” in Thunar. The tutorial tells me that I need the package gksu for this. When I wanted to install it with yay, I got this choice:

[uwe@HAL ~]$ yay gksu
6 aur/gtksu-git 0.0.r98.9372747-1 (+0 0.00) (Out-of-date: 2020-06-07) 
    A Qt5-based replacement for gksu
5 aur/caja-gksu 1.23.0-1 (+1 0.00) 
    Allows you to open files with administration privileges using the context menu when browsing your files with Caja.
4 aur/libgksu-colormap-fix 2.0.12-6 (+2 0.00) 
    gksu authorization library (with libgksu-rgba-fix.diff patch)
3 aur/gksu-polkit-git 2:0.0.2.r3.gd7e3160-1 (+14 0.00) 
    Replacement for gksu that uses PolicyKit
2 aur/libgksu 2.0.12-8 (+58 1.80) 
    gksu authorization library
1 aur/gksu 2.0.2-6 (+73 1.93) 
    A graphical frontend for su
==> Packages to install (eg: 1 2 3, 1-3 or ^4)
==> 

#5 and #6 are already dropped (Xfce), but which of the others should I install now?

If the tutorial mentions ‘gksu’, then you probably want to install aur/gksu (#1)

However, we have policy kit now. Quoting from https://wiki.gnome.org/Attic/gksu

gksu is a library and application used to ask the user for passwords to run programs as root. It is not a good option now that we have PolicyKit. Still, we still have applications which are not written to take advantage of the PolicyKit framework, and since making applications use it usually involves structural changes, a new version of gksu will provide functionality similar to the one provided by the current gksu to cover applications which still haven’t been patched to use PolicyKit.

While mounting drives, I see Thunar using polkit to grant access. So, You may want to go with aur/gksu-polkit-git (#3)

Share a link to the tutorial and I can better explain then.

1 Like

https://wiki.ubuntuusers.de/Thunar/Benutzerdefinierte_Aktionen/

1 Like

Okay, PolicyKit sounds good, but it doesn’t help in this case.

Did you try ?

sudo pkexec thunar

1 Like

Wouldn’t pkexec thunar be sufficient?

3 Likes

without sudo please :wink:

pkexec thunar

https://www.freedesktop.org/software/polkit/docs/0.105/pkexec.1.html

6 Likes

Yes, it works, but sudo thunar seems to have the same effect.

I installed aur/gksu and Open as Root works fine

1 Like

as @joekamprad pointed UP remove the sudo by security

EDIT : I removed it UP

REDIT : @dalto pointed UP also :ok_hand:

2 Likes

The environment that PROGRAM will run it, will be set to a minimal known and safe environment in order to avoid injecting code through LD_LIBRARY_PATH or similar mechanisms. In addition the PKEXEC_UID environment variable is set to the user id of the process invoking pkexec . As a result, pkexec will not allow you to run X11 applications as another user since the $DISPLAY and $XAUTHORITY environment variables are not set. These two variables will be retained if the org.freedesktop.policykit.exec.allow_gui annotation on an action is set to a nonempty value; this is discouraged, though, and should only be used for legacy programs.

it is the recommended way today as it will be more save on not changing environment stuff on users home e.t.c.

4 Likes

same time posting:
2020-08-12_14-23

7 Likes

Danke @joekamprad, Deine Version klingt sehr einleuchtend.

Ich habe pkexec thunar ausgeführt, es wird mein Passwort verlangt, und Thunar öffnet sich als root.

Thanks @joekamprad , your version sounds very plausible.

I have run pkexec thunar, my password is requested, and Thunar opens as root.

3 Likes

Thank you all! :+1:

2 Likes

When this happens you always read the last one ! :upside_down_face: