Loop devices, i.e. for mounting raw disk images, can be managed without root privileges using udisks.
For testing purposes, an image can be created and formatted like so:
dd if=/dev/urandom of=img.img bs=1M count=16 mkfs.ext4 img.img
And then setup using udisks
udisksctl loop-setup -f img.img
This creates a loop device for the image and mounts it to a new directory under
/run/$USER, just like any local hard drive managed by udisks. Only the permissions are not what I expected.
# ls -l /run/media/$USER/ drwxr-xr-x 3 root root 1024 Apr 10 11:19 [some id] drwx------ 1 auser auser 12288 Oct 30 2012 [a device label]
The first one listed is the loop device, owned by root and not writable by anybody else. The second one is a local hard drive or an USB pen device mounted for comparison, belonging to the user who mounted it. I know that I could fix this with a simple
chmod executed as root.
But why does udisks assign different permissions and owners? Can it be configured to do otherwise?