USB Flash Drive Permissions

Roland Smith rsmith at xs4all.nl
Fri Apr 11 17:30:29 UTC 2008


On Fri, Apr 11, 2008 at 09:36:40AM -0700, Loren M. Lang wrote:
> I would like to setup my USB flash drive to have special permissions
> when I plug it into my desktop.  Specifically, I would like it to be
> owned by my user so I can user mount the msdos fs on it.  I added an

To mount as a normal user you need to own the mount point. And set the
sysctl vfs.usermount to 1. 

> entry to /etc/devfs.conf for the device it was creating, but the
> permissions did not get applied when I plugged my drive in.  After some
> research, it appears that devfs.conf only gets applied on boot by
> /etc/rc.d/devfs so I took a look at devd.

For setting permissions on hotpluggable device nodes, you need to look
at devfs.rules. See
http://www.xs4all.nl/~rsmith/freebsd/index.html#hotplug

>  I catted the pipe of devd and
> saw my device attach as umass0 with a serial number that would be ideal
> to match on (I'd prefer that it only match on my personal flash
> drive,)

Normally, a da device gets the first available number. This way you
cannot tell which device node your flash drive will get. You will need a
to set a label on the flash drive. The tool newfs_msdos or the mtools
port can do that for you. Next time you plug the device in you will find
it as /dev/msdosfs/<label>, which you can use in devfs.rules.

Roland
-- 
R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20080411/546e7b54/attachment.pgp


More information about the freebsd-questions mailing list