With “gksu” being phased out of Linux distributions and the recommended replacement – “pkexec” – being so fucked up that you need to create a separate XML file in “
/usr/share/polkit-1/actions” for each GUI program you want to run as root, it’s time to improvise.
Since security is a joke for distro maintainers, we might as well join the party and use buggy ol’ “sudo” instead, after configuring it to slightly reduce the attack surface. In “/etc/sudoers” add:
Defaults timestamp_timeout = 0
This will force the damn thing to ask for a password each time it’s being run, instead of remembering it for 5 minutes.
Now set a graphical password-asking program in “/etc/sudo.conf” (you might need to install one first – “x11-ssh-askpass” is ugly as hell, “ksshaskpass” and “ssh-askpass-fullscreen” I haven’t tried because I liked “lxqt-openssh-askpass”):
Path askpass /usr/bin/lxqt-openssh-askpass
Now you can use “sudo -A …” to run graphical programs as root:
sudo -A xfce4-terminal --maximize --working-directory /root --tab --working-directory /root