Mount encrypted volume in read/write mode

ph flag

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
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?

ph flag

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
I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.