FreeBSD 5.2 How do I let ordinary users mount floppies, CDROMs and other removablemedia?'

Stan Sorochan stan.de at gmx.net
Thu Feb 3 13:54:27 PST 2005


Yes!!!  It's been figured out!

Thanks to great advice in this mailing list!  Many many thanks to those who 
spent their time to write!

So to recap!  In order to be able to mount removable media without su on 
FreeBSD 5.X this has to be done:

vfs.usermount=1

is to be put into /etc/sysctl.conf

The following lines are to be added to /etc/devfs.conf:

# Allow members of cdrom to mount the ide cdrom
own     acd0    root:cdrom
perm    acd0    0660

# Allow members of floppy group to mount fd
own     fd0     root:floppy
perm    fd0     0660

The follwing lines are to be added to /etc/devfs.rules:

[userbox_usb=10]
add path 'da*' mode 0660 group usb
#more of the usb devices are to be added here (scanners, digicams, etc)

The following line is to be added to /etc/rc.conf so that the rules are 
loaded:

#Load the ruleset that allows mounting of devices for users
devfs_system_ruleset="userbox_usb"

The last thing to do is to make sure that the appropriate modules are loaded 
into the kernel.  If some are not compiled into the kernel, like msdosfs.ko 
or cd9660.ko for example, see /boot/examples/loader.conf for guidance on how 
to load them at boot time.  The appropriate lines are to be added to /boot/
loader.conf

That's it!  After that you can have users that don't know the superuser 
password use cd's, floppies, usb flash drives etc (if you let them of 
course). 

The above is just the basics, it can be followed by entries in the /etc/fstab 
file, automounting setups and even scripts that make flash drive icons appear 
on KDE desktop as they become available, and disapear as the flash drive is 
removed...

Did I miss anything?



On Thursday 03 February 2005 16:14, Lowell Gilbert wrote:
> stan.de at gmx.net (Stan Sorochan) writes:
> > Then I do a su, mount the device, unmount it - and now I can mount the
> > device without su rights....
> >
> > OK, that sort of works, but the su part really has to go....  How can I
> > fix that?
>
> The su part is necessary because it loads a kernel module for you.
> I'm guessing that it's the msdosfs module.  Just compile that into
> your kernel, or load it from /boot/loader.conf, and msdosfs support
> will be automatically pre-loaded before your first mount attempt.


On Thursday 03 February 2005 01:19, Arne "WЖrner" wrote:
> > OK, that sort of works, but the su part really has to go....
> > How can I fix that?
>
> You could write a little shell script and put it in
> /usr/local/etc/rc.d .
>
> This shell script mounts and unmounts the device...
>
> quod erat faciendum. Or not? :-))
>
> -Arne


-- 
Stan Sorochan
www.unixoid.cjb.net



More information about the freebsd-fs mailing list