View Full Version : how to mount iso image without root privilege
fender0107401
March 22nd, 2009, 03:16
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
March 22nd, 2009, 04:52
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
March 23rd, 2009, 15:29
You also need to allow usermount by editing sysctl.conf.
That one opens possible security hole, it is documented somewhere in bugs list .....
aharonf
March 23rd, 2009, 16:42
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
March 23rd, 2009, 16:50
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
March 23rd, 2009, 16:57
And if you just need to access contents of .iso image, libarchive (read tar) can read iso9660 images.
fender0107401
March 24th, 2009, 02:40
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
March 24th, 2009, 02:59
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
March 24th, 2009, 08:26
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.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.