1

If a user connects an usb-disk Nautilus shows this disk and allows the user to mount the disk by just clicking on it.

I am looking to achieve the same behavior with encrypted disks. Each disk is encrypted with the same key and the keyfile is distributed to all computers.

I have written an udev rule which does the cryptsetup luksOpen for the disk. This works fine.

But unfortunately Nautilus still detects the encrypted disk and asks the user for a password. And it does not detect the mapped and decrypted device.

How can I inform Nautilus about the device after my udev-rule opened the disk? How can I suppress the password dialog for the encrypted disk?

valpo
  • 51
  • In your /etc/fstab add some lines referring to mapped devices mounting them on /media/somewehre. So nautilus can use them to mount the devices. remember to use nofail and noauto as options. It might do the job. – Ravexina Jun 16 '20 at 12:57
  • Are you saying that your udev rule provides the decryption key (passphrase) but Nautilus still wants an admin (sudo) password? Or is Nautilus prompting for an already-provided (stored) decryption key instead of a sudo password? – user535733 Jun 16 '20 at 13:02
  • @user535733 nautilus prompts for a password to decrypt the detected usb disk. – valpo Jun 16 '20 at 13:17
  • Does your udev rule use gio mount (for gvfs/user) or mount (admin)? – user535733 Jun 16 '20 at 13:48
  • Neither, I am just running "cryptsetup luksOpen" in the udev rule. My idea was, that nautilus detects the decrypted disk after that and the user could mount/umount it in nautilus like any other disk. So I have a simple udev rule: KERNEL=="sd[a-z][0-9]", SUBSYSTEM=="block", ACTION=="add", RUN+="/usr/local/bin/usbmountcheck udev add $kernel $parent", and the script runs the cryptsetup. – valpo Jun 16 '20 at 14:02
  • Sounds similar to what I've just stumbled upon, under this question (https://askubuntu.com/questions/1421417/): Polkit rules. I've not managed to crack the magic incantation under /etc, but maybe it'll help you. – Tomislav Nakic-Alfirevic Aug 01 '22 at 20:17

0 Answers0