HOW TO: Allow Mounting Of ISO Files By A Regular User
The following HOW-TO describes a method to allow mounting of ISO files by a regular (non-root) user, something normally lacking in Linux. This method, including setup, has also been automated in the new mountiso script. Also note that bic and Xtract have been updated to make use of mountiso if installed.
Setting Up The System
Edit your /etc/fstab file and add these lines:
/tmp/mountiso-image.iso /mnt/iso auto ro,loop=/dev/loop7,user,noexec,noauto 0 0 /dev/loop7 /mnt/iso auto user,noexec,noauto 0 0
2) Issue these commands to ensure you have seven loop devices and a mount point:
sudo mknod -m660 /dev/loop0 b 7 0 sudo mknod -m660 /dev/loop1 b 7 1 sudo mknod -m660 /dev/loop2 b 7 2 sudo mknod -m660 /dev/loop3 b 7 3 sudo mknod -m660 /dev/loop4 b 7 4 sudo mknod -m660 /dev/loop5 b 7 5 sudo mknod -m660 /dev/loop6 b 7 6 sudo mknod -m660 /dev/loop7 b 7 7 sudo chown root:disk /dev/loop* sudo mkdir /mnt/iso
Note that you can use any loop device and any mount point you prefer. In this example /dev/loop7 and /mnt/iso are used. A higher loop device is used so that it won’t be in use by the system for other purposes.
Mounting And Unmounting
Once the above changes are saved, the file “/tmp/mountiso-image.iso” can be mounted and unmounted by a normal user. This file can also be a link to any ISO file you choose.
For example, to mount /home/user/example.iso (all commands issued as a normal user):
# First create link: ln -s /home/user/example.iso /tmp/mountiso-image.iso # Then mount it: mount /tmp/mountiso-image.iso # Then you can delete the link immediately: rm /tmp/mountiso-image.iso # You can now browse the contents of the ISO: ls /mnt/iso # To unmount: umount /mnt/iso
Note that when unmounting you may receive the error message:
loop: can’t delete device /dev/loop7: No such device or address
This error may be ignored – the unmount will be successful and will return a zero error code.
Sorry, the comment form is closed at this time.