I have this executable: /opt/lampp/manager-linux-x64.run
which needs to run as root.
If I execute this with sudo /opt/lampp/manager-linux-x64.run
then it works fine.
I would like to add an entry to the application menu so that I can access this program without a terminal. In previous versions of Ubuntu I would use gksudo
but this no longer exists in the latest version of Ubuntu. I was told the replacement for gksudo
is admin://
, so I tried both of these and neither work:
$ admin:///opt/lampp/manager-linux-x64.run
bash: admin:///opt/lampp/manager-linux-x64.run: No such file or directory
$ admin://opt/lampp/manager-linux-x64.run
bash: admin://opt/lampp/manager-linux-x64.run: No such file or directory
How do I use admin://
to execute a program as root?
I also tried pkexec
and it did not work correctly. This command works when executed in a terminal, but doesn't work when I add the exact code to a .desktop
file using the menu editor:
pkexec --user root env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /opt/lampp/manager-linux-x64.run
gksu
was depreciated some time ago (prior 17.04), normally replaced bypkexec
, maybe useful will be https://askubuntu.com/questions/78352/when-to-use-pkexec-vs-gksu-gksudo – guiverc Sep 18 '20 at 23:43pkexec
and it does not work because it can't find the display. I edited my question. – Aaron Franke Sep 18 '20 at 23:46pkexec
in the command to run as root; for example,gparted
andgufw
will automatically ask for an admin password without it. What happens if you just add the executable to your .desktop file? – ajgringo619 Sep 19 '20 at 00:16