Persistantly mount usb user writable
What is the problem
When attaching a usb (especially when that usb is encrypted with luks/cryptsetup) that disk gets auto-mounted read-only. This happens (at the least) in thunar.
It is annoying to manually mount the disk at each use or to change permissions/ownership at each use. Therefore we need a persistent solution.
This fix works best if the filesystem on the disk or the filesystem in the luks container has a label attached (note the -L argument):
$ mkfs.xfs -L enc-usb /dev/mapper/encrytpted-usb
First we (auto-)mount the disk. I do this using Thunar (which in turn uses gvfs).
Then we need to find the (auto-)mountpoint of the disk. Find it using the label
$ mount|grep enc /dev/mapper/luks-54c61f75-d116-4db1-b4a5-12ab3cd456e7 on /run/media/username/enc-usb type xfs (rw,nosuid,nodev,relatime,attr2,inode64,noquota,uhelper=udisks2)
Now we know that the disk is mounted at “/run/media/username/enc-usb”.
Now we will ensure that the disk is owned by you, that the disk is writable for you, and that this information is set to be sticky:
$ chown username:usergroup /run/media/username/enc-usb $ chmod 1770 /run/media/hanckmannp/enc-usb $ sync
The last command ensures that the information is committed to the filesystem.
Now umount and remove the drive and re-attach it again. It should be writable to you automagically. This behaviour is persistent and survives reboots etc.