3

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?

6
  • Are you looking for 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. Commented Jul 8, 2013 at 21:23
  • write now the permissions are at -rwxrwxr-x 1 aarunkum aarunkum. What should I change it to so that I don't need sudo access to write to this image?
    – akhil28288
    Commented Jul 8, 2013 at 21:33
  • Is your user "aarunkum"?
    – user26112
    Commented Jul 8, 2013 at 22:33
  • Have a look at cat /proc/mounts. Is the volume mounted read-only? Commented Jul 9, 2013 at 2:31
  • You were able to edit /etc/fstab without root access? Wow, that's a barn door sized security hole if I ever heard of one.
    – user
    Commented Jul 9, 2013 at 19:45

2 Answers 2

1

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

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .