Currently, I do this to mount my encrypted thumbdrive:
# Works! pass thumbdrive-password | # get device password entry from password manager head -n 1 | # get the device password itself sudo cryptsetup luksOpen /dev/sdb thumbdrive # unlock device udisksctl mount -b /dev/mapper/thumbdrive # mount device I'd like to do something like this instead:
# Does not work! pass thumbdrive-password | head -n 1 | udisksctl unlock -b /dev/sdb # unlock device udisksctl mount -b /dev/mapper/luks-foobar # mount device with uuid "foobar" This would allow semi-privileged users (with permission to org.freedesktop.udisks2.filesystem-mount in polkit) to mount encrypted filesystems without using sudo. Udisks will not accept this piping method, because it uses an interactive password prompt. How can I provide my device password to udisksctl unlock without typing it in manually?
udisksctl unlock --block-device /dev/sdb --key-file <(printf "%s" "$(pass thumbdrive-password | head -n 1)")--key-fileappeared in v2.6.4. For eg not available in Debian stretch. OP didn't specify the distribution