Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Nov 2007 10:53:00 -0700
From:      "Darren Spruell" <phatbuckett@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Set perms on attach of USB umass disk
Message-ID:  <839aec700711011053i3b4d7c7dmbbd5afde03ba513a@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I've been trying (and failing) to figure out how to adjust ownership
or permissions of a USB memory stick on device attach.


umass0: SanDisk Corporation Cruzer Mini, rev 2.00/0.20, addr 5
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <SanDisk Cruzer Mini 0.4> Removable Direct Access SCSI-2 device
da0: 1.000MB/s transfers
da0: 977MB (2001888 512 byte sectors: 64H 32S/T 977C)

$ usbdevs -v
Controller /dev/usb0:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000),
Intel(0x0000), rev 1.00
 port 1 addr 2: full speed, power 100 mA, config 1, Dell USB Keyboard
Hub(0x1004), Dell(0x413c), rev 48.01
  port 1 addr 3: low speed, power 90 mA, config 1, Dell USB Keyboard
Hub(0x2006), Dell(0x413c), rev 48.00
  port 2 addr 5: full speed, power 100 mA, config 1, Cruzer
Mini(0x5150), SanDisk Corporation(0x0781), rev 0.20


I've tried altering devfs.conf but this appears to only work for
devices that are attached at startup of devfs. I've tried configuring
devd(8):

attach 100 {
        device-name "da[0-9]+s1";
        action "/bin/chmod 0660 $device-name";
};

attach 100 {
        device-name "da[0-9]+";
        action "/bin/chmod 0660 $device-name";
};

Neither of these seem to result in the permission change I'm after
(making device writable by my user which is in the operator group):

$ ls -l /dev/da0*
crw-r-----  1 root  operator    0, 165 Oct 21 13:08 /dev/da0
crw-r-----  1 root  operator    0, 166 Oct 21 13:08 /dev/da0s1

What's the right way to handle this?

-- 
Darren Spruell
phatbuckett@gmail.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?839aec700711011053i3b4d7c7dmbbd5afde03ba513a>