Skip to content

Instantly share code, notes, and snippets.

@KunalSin9h
Forked from grawity/_Example polkit rules_.md
Created September 10, 2023 14:26
Show Gist options
  • Save KunalSin9h/44cddbb22c1ab788a97323d2fb1eec9a to your computer and use it in GitHub Desktop.
Save KunalSin9h/44cddbb22c1ab788a97323d2fb1eec9a to your computer and use it in GitHub Desktop.
# /etc/polkit-1/localauthority/50-local.d/foo.pkla
[Allow users to power off always]
Identity=unix-group:users
Action=org.freedesktop.login1.power-off
ResultAny=yes
ResultActive=yes
ResultInactive=yes
# /etc/polkit-1/rules.d/foo.rules
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.login1.power-off" &&
subject.isInGroup("users")) {
return polkit.Result.YES;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment