- 
      
- 
        Save KunalSin9h/44cddbb22c1ab788a97323d2fb1eec9a to your computer and use it in GitHub Desktop. 
Revisions
- 
        grawity revised this gist Feb 12, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ **These are only examples,** for a few very common actions. You are expected to write your own rules for the rest. The syntax is regular JavaScript, but see the `polkit(8)` manpage for the object structure and available API. **These examples are for polkit versions 106 and later, with the JS interpreter.** They won't work with Debian's polkit v105. - If you don't know the action name, run `pkaction`: 
- 
        grawity revised this gist Jan 26, 2016 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ polkit.addRule(function(action, subject) { if (action.id == "org.freedesktop.systemd1.manage-units" && action.lookup("unit") == "hybrid.service" && subject.user == "michael") { return polkit.Result.YES; } }) 
- 
        grawity revised this gist Oct 9, 2015 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,13 @@ **These are only examples,** for a few very common actions. You are expected to write your own rules for the rest. The syntax is regular JavaScript, but see the `polkit(8)` manpage for the object structure and available API. - If you don't know the action name, run `pkaction`: pkaction | grep cups - The possible results are `YES`, `AUTH_SELF(_KEEP)`, `AUTH_ADMIN(_KEEP)`, `NO`. Returning a result is final. Returning `null` will continue checking other rules. - Put your rules in `/etc/polkit-1/rules.d/*.rules`. (You can check everything in one giant addRule, or you can have a separate file and separate addRule for each program; it doesn't matter.) - To test your rules, use `pkcheck`: pkcheck -u -p $$ -a org.freedesktop.packagekit.upgrade-system 
- 
        grawity revised this gist Jan 11, 2015 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,8 @@ If you don't know the action name, run `pkaction`: pkaction | grep cups The possible results are `YES`, `AUTH_SELF(_KEEP)`, `AUTH_ADMIN(_KEEP)`, `NO`. Returning a result is final. Returning `null` will continue checking other rules. Put your rules in `/etc/polkit-1/rules.d/*.rules`. (You can check everything in one giant addRule, or you can have a separate file and separate addRule for each program; it doesn't matter.) To test your rules, use `pkcheck`: 
- 
        grawity revised this gist Jan 11, 2015 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,4 @@ **These are only examples,** for a few very common actions. You are expected to write your own rules for the rest. See the `polkit(8)` manpage for rule syntax. (It's JavaScript.) If you don't know the action name, run `pkaction`: 
- 
        grawity revised this gist Jan 11, 2015 . 6 changed files with 13 additions and 14 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,13 @@ **These are only examples,** for a few very common actions. You are expected to write your own rules for the rest. See the `polkit(8)` manpage for rule syntax. (It's JavaScript.) If you don't know the action name, run `pkaction`: pkaction | grep cups Put your rules in `/etc/polkit-1/rules.d/*.rules`. (You can check everything in one giant addRule, or you can have a separate file and separate addRule for each program; it doesn't matter.) To test your rules, use `pkcheck`: pkcheck -u -p $$ -a org.freedesktop.packagekit.upgrade-system This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ /* Copy this to /etc/polkit-1/rules.d/80-networkmanager-wheel-without-authentication.rules */ polkit.addRule(function(action, subject) { if (/^org\.freedesktop\.NetworkManager\./.test(action.id) && This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ /* Copy this to /etc/polkit-1/rules.d/packagekit-restrict.rules */ polkit.addRule(function(action, subject) { if (/^org\.freedesktop\.packagekit\./.test(action.id)) { This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ /* Copy this to /etc/polkit-1/rules.d/udisks-no-consolekit.rules */ polkit.addRule(function(action, subject) { if (action.id == "org.freedesktop.udisks.filesystem-mount") { This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ /* Copy this to /etc/polkit-1/rules.d/always-allow-wheel.rules */ polkit.addRule(function(action, subject) { if (/^org\.freedesktop\.udisks\./.test(action.id) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ /* Copy this to /etc/polkit-1/rules.d/allow-mount-internal.rules */ polkit.addRule(function(action, subject) { if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" || 
- 
        grawity revised this gist Dec 27, 2014 . 3 changed files with 7 additions and 4 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,8 @@ polkit.addRule(function(action, subject) { if (/^org\.freedesktop\.NetworkManager\./.test(action.id) && subject.local && subject.active && subject.isInGroup("wheel")) { return polkit.Result.YES; } }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,8 +2,9 @@ */ polkit.addRule(function(action, subject) { if (/^org\.freedesktop\.udisks\./.test(action.id) && subject.isInGroup("wheel")) { return polkit.Result.YES; } }); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,8 @@ polkit.addRule(function(action, subject) { if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" || action.id == "org.freedesktop.udisks.filesystem-mount-system-internal") && subject.local && subject.active && subject.isInGroup("users")) { return polkit.Result.YES; } }); 
- 
        grawity revised this gist Aug 11, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ polkit.addRule(function(action, subject) { if (/^org\.freedesktop\.packagekit\./.test(action.id)) { if (subject.user === "fred" || subject.isInGroup("wheel")) { return polkit.Result.YES; } else { return polkit.Result.AUTH_ADMIN_KEEP; 
- 
        grawity revised this gist Oct 9, 2013 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ /* Copy this to /etc/polkit-1/rules.d/80-networkmanager-wheel-without-authentication.rules */ polkit.addRule(function(action, subject) { if (/^org\.freedesktop\.NetworkManager\./.test(action.id) && subject.local && subject.active && subject.isInGroup("wheel")) { return polkit.Result.YES; } }); 
- 
        grawity revised this gist Sep 8, 2013 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ /* Copy this to /etc/polkit-1/rules.d/udisks-no-consolekit.rules */ polkit.addRule(function(action, subject) { if (action.id == "org.freedesktop.udisks.filesystem-mount") { if (subject.isInGroup("wheel")) return polkit.Result.YES; else return polkit.Result.AUTH_ADMIN_KEEP; } else if (/^org\.freedesktop\.udisks\./.test(action.id)) { return polkit.Result.AUTH_ADMIN_KEEP; } }); 
- 
        grawity revised this gist Sep 8, 2013 . 3 changed files with 5 additions and 2 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ /* Copy this to /etc/polkit-1/rules.d/packagekit-restrict.rules */ polkit.addRule(function(action, subject) { if (/^org\.freedesktop\.packagekit\./.test(action.id)) { This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ /* Copy this to /etc/polkit-1/rules.d/always-allow-wheel.rules */ polkit.addRule(function(action, subject) { if (/^org\.freedesktop\.udisks\./.test(action.id) && subject.isInGroup("wheel")) { This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ /* Copy this to /etc/polkit-1/rules.d/allow-mount-internal.rules */ polkit.addRule(function(action, subject) { if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" || 
- 
        grawity revised this gist Sep 8, 2013 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ polkit.addRule(function(action, subject) { if (/^org\.freedesktop\.udisks\./.test(action.id) && subject.isInGroup("wheel")) { return polkit.Result.YES; } }); 
- 
        grawity renamed this gist Jun 3, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewingFile renamed without changes.
- 
        grawity revised this gist Jun 3, 2013 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,9 @@ Put your rules in `/etc/polkit-1/rules.d/*.rules`. See the `polkit(8)` manpage for rule syntax. (It's JavaScript.) If you don't know the action name, run `pkaction`. To test your rules, use `pkcheck`. `pkcheck -u -p $$ -a org.freedesktop.packagekit.upgrade-system` 
- 
        grawity revised this gist Jun 3, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@ Put your rules in `/etc/polkit-1/rules.d/*.rules`. See the `polkit(8)` manpage for rule syntax. 
- 
        grawity revised this gist Jun 3, 2013 . 2 changed files with 13 additions and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ Put your rules in `/etc/polkit-1/rules.d/*.rules`. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ /* Copy this to /etc/polkit-1/rules.d/packagekit-restrict.rules */ polkit.addRule(function(action, subject) { if (/^org\.freedesktop\.packagekit\./.test(action.id)) { if (subject.local && subject.active && subject.isInGroup("wheel")) { return polkit.Result.YES; } else { return polkit.Result.AUTH_ADMIN_KEEP; } } }); 
- 
        grawity revised this gist Dec 30, 2012 . 2 changed files with 10 additions and 8 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ /* Copy this to /etc/polkit-1/rules.d/allow-mount-internal.rules */ polkit.addRule(function(action, subject) { if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" || action.id == "org.freedesktop.udisks.filesystem-mount-system-internal") && subject.local && subject.active && subject.isInGroup("users")) { return polkit.Result.YES; } }); 
- 
        grawity revised this gist Nov 16, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ /* /etc/polkit-1/rules.d/allow-mount-system.rules */ polkit.addRule(function(action, subject) { if (action.id == "org.freedesktop.udisks2.filesystem-mount-system" && 
- 
        grawity revised this gist Nov 16, 2012 . 3 changed files with 8 additions and 16 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ # /etc/polkit-1/rules.d/allow-mount-system.rules polkit.addRule(function(action, subject) { if (action.id == "org.freedesktop.udisks2.filesystem-mount-system" && subject.local && subject.active && subject.isInGroup("users")) { return polkit.Result.YES; } }); 
- 
        grawity revised this gist Oct 13, 2012 . 2 changed files with 5 additions and 1 deletion.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ # /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 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,8 @@ # /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; } }); 
- 
        grawity revised this gist Oct 13, 2012 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ polkit.addRule(function(action, subject) { if (action.id == "org.freedesktop.login1.power-off" && subject.isInGroup("users")) { return polkit.Result.YES; } }); 
- 
        grawity created this gist Oct 13, 2012 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ [Allow users to power off always] Identity=unix-group:users Action=org.freedesktop.login1.power-off ResultAny=yes ResultActive=yes ResultInactive=yes