I have a program that I wish all users of my linux install to be able to run with root privileges from a .desktop file.

Currently in my .desktop file I have:

Exec=gksu command

but this of cause displays the gksu prompt. I assume I need to add a entry to my sudoers file to allow any user to run this command with root so that the .desktop file can just have:


However I am now sure how to set this up for all users.

  • 1
    If it is an executable (not a script) it might be easier to SUID and have it owned by root.
    – Anthon
    Nov 6, 2014 at 22:48
  • I would have said it is a sh script Nov 6, 2014 at 22:52
  • @ZacPowell - if your system is using policykit you could define a new polkit action, see my answer here. Nov 8, 2014 at 15:07

1 Answer 1


If you're using a non Red Hat distro then you can likely use gksudo to get a graphical prompt and then have the user's with the ability to run this single command via sudo.

For Fedora and other Red Hat distros you can use PolicyKit (you may be able to use this on other distros as well, I'm not able to test this currently). PolicyKit includes the tool pkexec.

$ pkexec [--user username] PROGRAM [ARGUMENTS...]


  • Debian (and probably Debian-based distros, at least Ubuntu doesn't) doesn't have gksu/do by default either, while they have pkexec from the policykit-1 package which in turn is dependency of network-manager. So, as long as you use network manager you can say the polkit is instaled.
    – Braiam
    Nov 7, 2014 at 0:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .