Re: How to use Udev to restrict USB access only to particular set of USB sticks?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vilius Benetis wrote:
> [Vilius]
>> tomorrow I will play with the code.
> the resulting UDEV rules (with reference to works of Adrian Crenshaw),
> for those who are interested:
> 
> #By default, disable it.
> ACTION=="add", SUBSYSTEMS=="usb", RUN+="/bin/sh -c 'for host in
> /sys/bus/usb/devices/usb*; do echo 0 > $host/authorized_default;
> done'"

It may not be possible to do what I'm about to suggest with this rule
(unless there's a way to match on all devices that have an
authorized_default file -- I'm not sure where in the USB stack those
devices are), but for this rule:

> #Enable hub devices.
> ACTION=="add", ATTR{bDeviceClass}=="09", RUN+="/bin/sh -c 'echo 1
>> /sys$DEVPATH/authorized'"

(and the one below it), can't you just do this instead of the RUN?:

ATTR{authorized}="1"

Or does that not work for some reason?  (It'll prevent spawning a whole
lot of shells to do work that udev already has code to handle...)

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux