Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to mount a disk image located on an NFS network share without copying it first.

Only a non-root user (apache) on the RHEL 5 machine I'm on has permissions to access the files on that network share.

sudo mount / sudo losetup both didn't work, as I lose permission to access the files. Adding an /etc/fstab entry with user flag didn't work either. chmod ugo+rw on the network share also failed.

Is there any way to mount these disk images without copying them first?


Doing what @Malvineous suggested:

$ losetup -o 512 /dev/loop7 img.img
/dev/loop7: Permission denied

# chown apache:apache /dev/loop7

$ losetup -o 512 /dev/loop7 img.img
memlock: Cannot allocate memory
Couldn't lock into memory, exiting.

Doing the exact same thing as root works.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

What happens if you chown apache /dev/loop0 then use losetup as the apache user to set up the loopback device. You should then be able to mount /dev/loop0 as root.

In response to the updated question:

A quick Google suggests you should be able to get around it by increasing the amount of memory you, as a normal user, can lock. As only root can do this, you will need to su to root, run "ulimit -l unlimited" to remove the limit, then su to the user you were before (don't logout like you normally would to go back to your normal user or you'll restore the previous limit in the process.)

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.