public
Last active

PolKit rules to allow mounting, rebooting and network management without a password

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
// /etc/polkit-1/rules.d/10-rules.rules
// 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.freedesktop.upower.") && subject.isInGroup("power")) {
return polkit.Result.YES;
}
});
 
polkit.addRule(function(action, subject) {
if (action.id.match("org.freedesktop.NetworkManager.") && subject.isInGroup("users")) {
return polkit.Result.YES;
}
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.