Created
March 13, 2021 03:19
-
-
Save hucsmn/2cc247375d0bff19415470f8b4bc0a24 to your computer and use it in GitHub Desktop.
PolicyKit udisk2 rules that allows auto mounting
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 characters
/* | |
* Allow partition auto mounting for desktop environments. | |
* Put this file in /etc/polkit-1/rules.d/ then add user to the storage or disk group. | |
*/ | |
// allowed actions | |
var udisks2_actions = [ | |
'org.freedesktop.udisks2.filesystem-mount-system', | |
'org.freedesktop.udisks2.filesystem-mount', | |
]; | |
// allowed groups | |
var udisks2_groups = ['storage', 'disk', 'wheel', 'adm']; | |
polkit.addRule(function(action, subject) { | |
if (udisks2_actions.some(id => action.id == id) && udisks2_groups.some(group => subject.isInGroup(group))) { | |
return polkit.Result.YES; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment