USB Flash Drive Permissions

Giorgos Keramidas keramida at
Fri Apr 11 21:09:20 UTC 2008

On Fri, 11 Apr 2008 19:30:25 +0200, Roland Smith <rsmith at> wrote:
> For setting permissions on hotpluggable device nodes, you need to look
> at devfs.rules. See

Excellent stuff :)

>> 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.

Just a short additional note: newfs(8) -- the UFS/UFS2 version -- also
supports labels.  I use UFS labels in the build of bootable USB images,
to make it possible to have somewhat predictable mount points for the
root filesystem in /etc/fstab, i.e.:

    # Device          Mountpoint FStype  Options Dump  Pass#
    /dev/ufs/USBROOT  none       ufs     rw      1     1

More information about the freebsd-questions mailing list