Mounting partitions without a password using Udisks2

5,381

AFAIK udisks needs a policykit rule to allow an unauthenticated user to mount disks. See this page for an example of how to write the rule:

https://www.dynacont.net/documentation/linux/udisks2_polkit_Allow_unauthenticated_mounting/

Share:
5,381

Related videos on Youtube

Heptametrical
Author by

Heptametrical

Updated on September 18, 2022

Comments

  • Heptametrical
    Heptametrical almost 2 years

    I'm trying to mount some partitions on my hard drive by clicking them in thunar or running udisksctl mount -b /dev/sdb6 & in a script, but I can't find a way for this not to come up with a password prompt.

    I am in the groups <myusername> wheel users. I wasn't in the users group to start with, so i added myself to it in an attempt to make this work.

    My fstab looks like this:

    #
    # /etc/fstab
    # Created by anaconda on Sun Mar 12 19:43:55 2017
    #
    # Accessible filesystems, by reference, are maintained under '/dev/disk'
    # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
    #
    /dev/mapper/luks-d7a09ab1-cfa0-4910-ad28-041248fd55ed /                       ext4    defaults,x-systemd.device-timeout=0 1 1
    UUID=d713df23-90c8-4ed3-9246-9467be868d5d /boot                   ext2    defaults        1 2
    /dev/sdb6   /run/media/username/shared/ vfat    noauto,user,exec,rw,async,atime 0 0
    /dev/sdb12  /run/media/username/extra/      ext4 noauto,user,exec,rw,async,atime    0 0
    

    Really, the whole purpose of this is to mount these two partitions on login without increasing boot time (they are media partitions), so if there's a way to do that in the background then that would be even better.

  • Heptametrical
    Heptametrical over 7 years
    That did the trick, thanks! To other searchers, a workaround with different problems is to have passwordless sudo enabled and run the command with sudo.
  • Alexander Kellett
    Alexander Kellett over 2 years
    Worked for me when changing the Action= line to Action=org.freedesktop.udisks2.filesystem-mount-other-seat . Thank you!