1

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:

Exec=command

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

Anthon
  • 78,313
  • 42
  • 165
  • 222
DevWithZachary
  • 229
  • 5
  • 12

1 Answers1

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...]

References

slm
  • 363,520
  • 117
  • 767
  • 871
  • 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 07 '14 at 00:13