I have been able to mount a ext2 image without having root access by adding an entry to /etc/fstab. However, I am not able to modify this image (copy a new file to it) without having sudo permissions. Is there a way to achieve this without having sudo permissions?
2 Answers
user
option in fstab
I think you just need to add the option user
to your /etc/fstab
entry if you want users to be able to mount the entry. For example:
/dev/cdrom /cd iso9660 ro,user,noauto,unhide
pmount
Also I think you can achieve what you want using the app pmount
.
excerpt from man page
pmount - mount arbitrary hotpluggable devices as normal user
To mount:
$ pmount /dev/sda1 /media/somedir
References
I figured out that this was not related to the permissions of the image file actually. It was related to the permissions within the image file. The file system permissions were set only for root. I mounted the image file and did a chown on all the directories within the diskimage making myself the owner. After that I am able to write to it without root permissions. It makes sense to have the permissions to the image file set to root, as that way the image file becomes portable.
chown
/chmod
? If the permissions of the (mounted) filesystem are set accordingly for that user, you should be able to create new files in it.cat /proc/mounts
. Is the volume mounted read-only?