Skip to content

Instantly share code, notes, and snippets.

@mariusor
Created November 9, 2016 18:57
Show Gist options
  • Save mariusor/fd876880a8ca2a63d93128ef0481c8f3 to your computer and use it in GitHub Desktop.
Save mariusor/fd876880a8ca2a63d93128ef0481c8f3 to your computer and use it in GitHub Desktop.
Polkit rules for KDE related actions
// /etc/polkit-1/rules.d/49-allow-by-group.conf
// PolKit rules to allow mounting, rebooting and network management without password.
// User needs to be in storage, power and users groups.
polkit.addRule(function(action, subject) {
if (action.id.match("org.freedesktop.udisks2.") && subject.isInGroup("storage")) {
return polkit.Result.YES;
}
});
polkit.addRule(function(action, subject) {
if (action.id.match("org.freedesktop.login1.") && subject.isInGroup("power")) {
return polkit.Result.YES;
}
});
polkit.addRule(function(action, subject) {
if (action.id.match("org.kde.kcontrol.kcmsddm.save") && subject.isInGroup("wheel")) {
return polkit.Result.YES;
}
});
polkit.addRule(function(action, subject) {
if (action.id.match("org.freedesktop.systemd.") && subject.isInGroup("wheel")) {
return polkit.Result.YES;
}
});
polkit.addRule(function(action, subject) {
if (action.id.match("org.freedesktop.upower.") && subject.isInGroup("power")) {
return polkit.Result.YES;
}
});
polkit.addRule(function(action, subject) {
if (action.id.match("org.freedesktop.kde") && subject.isInGroup("users")) {
return polkit.Result.YES;
}
});
polkit.addRule(function(action, subject) {
if (action.id.match("org.freedesktop.NetwormManager") && subject.isInGroup("users")) {
return polkit.Result.YES;
}
});
polkit.addRule(function(action, subject) {
if (action.id.match("org.freedesktop.ModemManager1") && 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