0

The canonical method to mount encrypted volumes from the command line on later Ubuntu editions involves udisksctl. However, that recipe mounts the volume in read-only mode.

$ udisksctl unlock -b /dev/sdd1
Passphrase:
Unlocked /dev/sdd1 as /dev/dm-1.

$ ls -la /dev/mapper total 0 drwxr-xr-x 2 root root 100 apr 2 12:58 . drwxr-xr-x 20 root root 4860 apr 2 12:58 .. crw------- 1 root root 10, 236 mrt 28 19:27 control lrwxrwxrwx 1 root root 7 apr 2 12:58 luks-1841d2d1-4ce7-46e4-805e-0be262199e7d -> ../dm-1 lrwxrwxrwx 1 root root 7 apr 2 12:53 NOAB -> ../dm-0

$ udisksctl mount -b /dev/mapper/luks-1841d2d1-4ce7-46e4-805e-0be262199e7d Mounted /dev/dm-1 at /media/user/NOAB

$ cd /media/user/NOAB

$ touch test.txt touch: cannot touch 'test.txt': Read-only file system

Going through the udisksctl manual I understand it takes the same arguments as good old mount. So I gave it a try:

$ udisksctl unmount -b /dev/mapper/luks-1841d2d1-4ce7-46e4-805e-0be262199e7d
Unmounted /dev/dm-1.

$ udisksctl mount -o umask=0 -b /dev/mapper/luks-1841d2d1-4ce7-46e4-805e-0be262199e7d Error mounting /dev/dm-1: GDBus.Error:org.freedesktop.UDisks2.Error.OptionNotPermitted: Mount option `umask=0' is not allowed

Is there some other way of passing the umask argument to udisksctl? Or any other method to mount the volume in read and write mode?

Luís de Sousa
  • 13,227
  • 26
  • 81
  • 128

1 Answers1

0

This issue seems to be rooted with udisksctl, perhaps a limitation with this tool. The solution is to decrypt the volume with cryptsetup and mount directly with mount (log below). It also functions correctly mounting to the /media/user folder.

$ sudo cryptsetup open /dev/sdd1 NOABdev
Enter passphrase for /dev/sdd1:

$ mkdir -p ~/mount/test

$ sudo mount /dev/mapper/NOABdev ~/mount/test

$ touch ~/mount/test/test.txt

Luís de Sousa
  • 13,227
  • 26
  • 81
  • 128