automount usb flash drive?

Todd Shirk ts4short at gmail.com
Thu Apr 7 10:55:12 PDT 2005


Seems like the only thing that will work for me is to make a one-line
shell script.  I tried the various things you mentioned.  I have yet
to look at how to use amd(8).  Setting vfs.usermount=1 and changing
the ownership to the user name in question allows me to mount the
usbkey without su'ing.  I still can't get the usbd.conf to run an
attach command on the umass* action.  Thanks for your help.

On Apr 6, 2005 4:01 PM, Roland Smith <rsmith at xs4all.nl> wrote:
> On Wed, Apr 06, 2005 at 03:32:14PM -0400, Todd Shirk wrote:
> > I was trying to figure out how to have a usb flash drive automount
> > when I plug it in.  I currently have the following line in /etc/fstab
> >
> > /dev/da0s1  /mnt/usbkey  msdos  rw,-m700,noauto  0  0
> >
> > and the following in /etc/devfs.conf
> >
> > perm  da0s1  0666
> 
> devfs.conf only works for devices available at boot time. For devices
> you can plug in at runtime you should use /etc/devfs.rules:
> 
> [foobar=10]
> add path 'da*s*' mode 0666
> 
> And you should have the following in /etc/rc.conf:
> 
> devfs_system_ruleset="foobar"
> 
> The contents of devfs.rules are fed to devfs(8), so see it's manual page.
> 
> > when I do the following command line command the usb flash drive mount fine
> >
> > # mount /mnt/usbkey
> >
> > But, when I'm in KDE viewing media:/  Removable Device (da0s1) is
> > shown is unmounted.
> >
> > At the user level command line and in KDE, I receive /dev/da0s1:
> > Operation not permitted.
> 
> For a user to be able to use a filesystem, there are a couple of things
> that need to be done:
> - The sysctl variable vfs.usermount must be set to 1 (in /etc/sysctl.conf).
> - The user in question must own the mount point.
> 
> > I'm not sure if part of the issue is permissions or if I'm missing a
> > piece for the auto-mounting to happen.
> 
> I think the latter. Normally usbd(8) is notified of USB events, but in
> this case it seems to get events for the umass* device, not the da*s*
> device that you'll want to use. There have been people who've used a
> shell-script called by usbd to figure out the connection between
> umass<->da from dmesg output and then mount the filesystem, but that
> doesn't do umounts. It's also complicated if you want it to work for
> multiple users, unless you give it 777 permissions. You could also give
> amd(8) a try.
> 
> I found that making a one-line shell script to do the mounting is much
> less hassle.
> 
> Roland
> --
> R.F. Smith                           /"\    ASCII Ribbon Campaign
> r s m i t h @ x s 4 a l l . n l      \ /    No HTML/RTF in e-mail
> http://www.xs4all.nl/~rsmith/         X     No Word docs in e-mail
> public key: http://www.keyserver.net / \    Respect for open standards
> 
> 
>


More information about the freebsd-questions mailing list