Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nvgoldin/c040ec0ebfa143dcf523939e5a8475c9 to your computer and use it in GitHub Desktop.
Save nvgoldin/c040ec0ebfa143dcf523939e5a8475c9 to your computer and use it in GitHub Desktop.
Example of allowing management of individual systemd units with polkit
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.systemd1.manage-units") {
if (action.lookup("unit") == "myservice.service") {
var verb = action.lookup("verb");
if (verb == "start" || verb == "stop" || verb == "restart") {
return polkit.Result.YES;
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment