removable devices auto umounting

Da Rock rock_on_the_web at comcen.com.au
Fri Mar 21 17:28:09 PDT 2008


On Fri, 2008-03-21 at 16:21 +0100, Tijl Coosemans wrote:
> >> On Thu, Mar 20, 2008 at 11:55:32AM +1000, Da Rock wrote:
> >>> I'm just looking into the removable device issue for freebsd. I can
> >>> see its easy enough to auto mount a removable device (although I
> >>> could use some help getting sd/xd devices working with my card
> >>> reader), but the removal seems to come unstuck.
> >>> 
> >>> I have some barely literates on my systems, so I do need to work
> >>> this out. Is it possible to use a forced umount to do this? What
> >>> are the options here?
> 
> In KDE (same for GNOME and such I figure), removable devices like usb
> keys, cameras, cd/dvd are automounted and appear on the desktop.
> Using the right-click popup menu you can "Safely remove" or "Eject"
> them.
> 
> For this to work, you need to have sysutils/hal installed and configure
> x11/kdebase3 to enable hal support (this is the default).
> 
> Then you need to give users permission to access necessary devices.
> It's best to create a separate group for that like plugdev and then
> add users to this group. To give a plugdev group access to devices
> create/edit the file /etc/devfs.rules to contain:
> 
> --- begin /etc/devfs.rules ---
> [local_ruleset=10]
> #allow plugdev to access the CAM subsystem (required for cd/dvd burning and usb mass storage)
> add path xpt0 user root group plugdev mode 0660
> add path 'pass*' user root group plugdev mode 0660
> #only allow root for specific fixed SCSI drives if any
> #add path pass0 user root group operator mode 0660
> #add path pass1 user root group operator mode 0660
> #...
> 
> #allow plugdev to access the cdrom
> add path cd0 user root group plugdev mode 0660
> 
> #allow plugdev to access usb mass storage
> add path 'da*' user root group plugdev mode 0660
> #only allow root for specific fixed SCSI drives if any
> #add path 'da0*' user root group operator mode 0660
> #add path 'da1*' user root group operator mode 0660
> #...
> 
> #allow plugdev to access generic usb devices (cameras/mp3 players using libusb)
> add path 'usb*' user root group plugdev mode 0660
> add path 'ugen*' user root group plugdev mode 0660
> --- end /etc/devfs.rules ---
> 
> (You don't need anything special in /etc/devfs.conf. If you've put
> stuff there to get cd burning working for normal users, you can
> remove it. (permission for cd,xpt,pass devices))
> 
> In /etc/rc.conf then make sure you have these lines:
> 
> dbus_enable="YES"
> devfs_system_ruleset="local_ruleset"
> hald_enable="YES"
> polkitd_enable="YES"
> 
> And finally, give plugdev access to hal by editing
> /usr/local/etc/dbus-1/system.d/hal.conf
> At the end of that file it says:
> 
>   <!-- You can change this to a more suitable user, or make per-group -->
>   <policy group="operator">
>     <allow send_interface="org.freedesktop.Hal.Device.SystemPowerManagement"/>
>     <allow send_interface="org.freedesktop.Hal.Device.LaptopPanel"/>
>     <allow send_interface="org.freedesktop.Hal.Device.Volume"/>
>     <allow send_interface="org.freedesktop.Hal.Device.Volume.Crypto"/>
>   </policy>
> 
> On the second line above, change "operator" to "plugdev".
> 
> Then make sure you have a /var/media directory and /media linking to it
> and nothing related to removable devices in /etc/fstab (including cdrom).
> Reboot your system and if I didn't miss anything, any user in the
> plugdev group should be able to use removable devices quite easily.

Thanks for that- I was just looking into that from the Project Utopia
article. Just a couple of things-

1. You still have to click eject before removing the device. Is there a
way to skip this and just remove the device?

2. The D-Bus system only works with an X wm doesn't it?

I know it seems contrary, but is there a way I can set this up so that
it will work from a standard tty? The amd system appears to allow this,
but it does have its faults as well.

Consider this theory: IF the X windows system is running- D-Bus and all-
can other background daemons use this system? I guess they wouldn't need
to concern themselves with this problem as the X windows will be taking
care of it automatically.

Another thought: do all wm's use the D-Bus? Or is it only kde and gnome?

Thanks for being a sounding board guys.



More information about the freebsd-questions mailing list