Skip to content

Instantly share code, notes, and snippets.

@sainak
Last active May 5, 2021 11:23
Show Gist options
  • Save sainak/9bbd19ba0cec55c796f1040a461bbef8 to your computer and use it in GitHub Desktop.
Save sainak/9bbd19ba0cec55c796f1040a461bbef8 to your computer and use it in GitHub Desktop.
udisks rules to let wheel group users mount drives without authentication
#Create the file /etc/polkit-1/rules.d/50-udisks.rules with permissions 644, and with the following contents:
polkit.addRule(function(action, subject) {
var YES = polkit.Result.YES;
var permission = {
// only required for udisks2:
"org.freedesktop.udisks2.filesystem-mount": YES,
"org.freedesktop.udisks2.encrypted-unlock": YES,
"org.freedesktop.udisks2.eject-media": YES,
"org.freedesktop.udisks2.power-off-drive": YES,
// Dolphin specific
"org.freedesktop.udisks2.filesystem-mount-system": YES,
// required for udisks2 if using udiskie from another seat (e.g. systemd):
"org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
"org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
"org.freedesktop.udisks2.eject-media-other-seat": YES,
"org.freedesktop.udisks2.power-off-drive-other-seat": YES
};
if (subject.isInGroup("wheel")) {
return permission[action.id];
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment