Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  frostschutz Jul 8 '13 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 Jul 8 '13 at 21:33
    
Is your user "aarunkum"? –  Evan Teitelman Jul 8 '13 at 22:33
    
Have a look at cat /proc/mounts. Is the volume mounted read-only? –  Hauke Laging Jul 9 '13 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. –  Michael Kjörling Jul 9 '13 at 19:45
show 1 more comment

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.