I'm running a raspbian stretch and I want to grant every member of group user the right to mount and unmount usb-pendrives

Therefore I installed: udisks2

I created a *.rules file /usr/share/polkit-1/rules.d/50-udisks.rules with the following content:

polkit.addRule(function(action, subject) {

var YES = polkit.Result.YES;
  var permission = {
    // only required for udisks1:
    "org.freedesktop.udisks.filesystem-mount": YES,
    "org.freedesktop.udisks.filesystem-mount-system-internal": YES,
    "org.freedesktop.udisks.luks-unlock": YES,
    "org.freedesktop.udisks.drive-eject": YES,
    "org.freedesktop.udisks.drive-detach": YES,
    // only required for udisks2:
    "org.freedesktop.udisks2.filesystem-mount": YES,
    "org.freedesktop.udisks2.filesystem-mount-system": YES,
    "org.freedesktop.udisks2.encrypted-unlock": YES,
    "org.freedesktop.udisks2.eject-media": YES,
    "org.freedesktop.udisks2.power-off-drive": 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("users")) {
    return permission[action.id];

I restarted the polkit service:

systemctl restart polkit

When issuing: udiskctl mount -b /dev/sda1 a user is still asked to login as root.

Any idea what is going wrong?

  • 1
    what is the name for that group user or users?
    – user192526
    Nov 30 '17 at 12:36
  • in my case it is users
    – Hias
    Nov 30 '17 at 13:40
  • 1
    A related question is unix.stackexchange.com/q/507975/5132 .
    – JdeBP
    May 24 '20 at 21:39

It seems it's due to the fact that Debian does not yet use the JavaScript style rules files. You have to place a *.pkla file like this in /etc/polkit-1/localauthority/50-local.d/53-udisk.pkla.

contents for a single user called "user":


[Enable Controlling of udisk]

This way it is working for me now on raspbian stretch or jessie!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.