I know that I can run GUI application as root by
gksudo but I want to know that How do I run GUI applications as root with the help of
When I tries to run
gedit (or any other application like:
pkexec gedit then It prompts for password for authentication:-
After entering password it exit with error:-
$ pkexec gedit
error: XDG_RUNTIME_DIR not set in the environment.
(gedit:6135): Gtk-WARNING **: cannot open display:
So, It seems something is going wrong with display environment.
I've also tried with
DISPLAY=:0 pkexec gedit but doesn't work.
Following information is available from
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.
Now I don't know What to do in order to accomplish this.
Thus, Help me to find out How to run GUI applications as root by means of
pkexec. Or Is this possible or not?
BTW, Inspired by
gparted-pkexeccommand which works fine. How