Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rmi1974/093d3ec55dd2d687506c81c637702754 to your computer and use it in GitHub Desktop.
Save rmi1974/093d3ec55dd2d687506c81c637702754 to your computer and use it in GitHub Desktop.
How to enable unauthenticated mounting of external disks using udisksctl #commandlinefu #udisksctl #mount

How to enable unauthenticated mounting of external disks using udisksctl

Courtesy of reddit thread

Create file /etc/polkit-1/rules.d/10-udisks2.rules with following content:

$ sudoedit /etc/polkit-1/rules.d/10-udisks2.rules

// See the polkit(8) man page for more information
// about configuring polkit.

// Allow udisks2 to mount devices without authentication
// for users in the "wheel" group.
polkit.addRule(function(action, subject) {
    if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" ||
         action.id == "org.freedesktop.udisks2.filesystem-mount") &&
        subject.isInGroup("wheel")) {
        return polkit.Result.YES;
    }
});

Test with some external drives attached:

$ for i in /dev/sd{c,d,e}1; do udisksctl mount -b $i; done

Mounted /dev/sdc1 at /run/media/focht/a71018aa-69e2-49f8-b8e7-0693f1141c34
Mounted /dev/sdd1 at /run/media/focht/5271a825-7d53-4e06-b729-e62a9f58a438
Mounted /dev/sde1 at /run/media/focht/864e27a4-37bc-46c3-b15c-fa0c3a0bd9ae

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment