# how to mount iso image without root privilege



## fender0107401 (Mar 22, 2009)

Hi all:

I know I can use "mdconfig" and "mount" command mount an iso image, but mdconfig need su to become root, so I want know can I mount the image as a normal user?


----------



## Oko (Mar 22, 2009)

fender0107401 said:
			
		

> Hi all:
> 
> I know I can use "mdconfig" and "mount" command mount an iso image, but mdconfig need su to become root, so I want know can I mount the image as a normal user?



Of course. Learn how to set up sudo on FreeBSD. Add yourself 
into the group which is allowed to execute mount command.
Do not forget that in order to mount you have to own device node 
of the CD-rom and the mount point (file to which you are mounting).
You also need to allow  usermount  by editing sysctl.conf.


----------



## richardpl (Mar 23, 2009)

Oko said:
			
		

> You also need to allow  usermount  by editing sysctl.conf.


That one opens possible security hole, it is documented somewhere in bugs list .....


----------



## aharonf (Mar 23, 2009)

Here is my suggestion for a way to do it that will not compromise your security too much.

1. Write a program that does exactly what you need (mdconfig ...; mount ...).  I am attaching such a program to this message.
2, As super user run:
   chown root <exec>
   chmod 4755 <exec>
This sets the set_uid bit on the file.  By doing this you are ensuring that this is the only mount task that can be performed by a non super user.


----------



## aharonf (Mar 23, 2009)

The following code creates, mounts, and unmounts an encrypted disk image.  Not exactly what you need, but close enough.


https://data.4noguilt.com/downloads/edisk.cpp


----------



## crsd (Mar 23, 2009)

And if you just need to access contents of .iso image, _libarchive_ (read _tar_) can read iso9660 images.


----------



## fender0107401 (Mar 24, 2009)

Hi all:

Thanks for the reply.

I use gnome, in gnome use mouse and double click the iso file can display the iso's content. So I think there must have someway mount ios as a normal user. I just want see the content, because I am learning how to produce or tailor a system image, and I like gnome-termial, I need a cli way to see the inside of the image.


----------



## Djn (Mar 24, 2009)

The port sysutils/fusefs-gnome-vfs will apparently allow you to mount any VFS that gnome understands to a directory - so if Nautilus can browse a CD image, it should also be mountable. I expect it to have the same root/setuid issues as the standard method, but I've never tested it - you might want to take a look.


----------



## SirDice (Mar 24, 2009)

fender0107401 said:
			
		

> I use gnome, in gnome use mouse and double click the iso file can display the iso's content.


Gnome uses the archive manager to show the contents.


> So I think there must have someway mount ios as a normal user.


The archive manager is just an application, it doesn't mount anything.


----------

