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:
> we tested, ATTR{authorized}="1" works well, for
> ATTR{authorized_default}="0" we get an error during the boot, but it
> still works (probably the error is due to the yet non-existing
> device?):
> 
> error opening ATTR{/sys/devices/pci0000:00/0000:00:1d.0/usb5/5-1/5-1:1.0/input/input11/event9/authorized}
> for writing: No such file or directory

That's matching the wrong thing when it tries to apply the rule to set
ATTR{authorized}, I think.  This shouldn't have anything to do with the
authorized_default rule, based on the name logged.

> the rules have been used:
> 
>        #By default, disable it.
>        ACTION=="add", SUBSYSTEMS=="usb", ATTR{authorized_default}="0"

I'd use SUBSYSTEM=="usb", TEST=="authorized_default" for this matching,
or something like that.  Any USB kobject with an authorized_default
attribute should have a zero written into it.

>        #Enable hub devices.
>        ACTION=="add", ATTR{bDeviceClass}=="09", ATTR{authorized}="1"
> 
>        #Other things to enable
>        ACTION=="add", ATTRS{idProduct}=="c052", ATTR{authorized}="1"

I'd use ATTR{idProduct} here, assuming that attribute is set that way on
the proper kobject in your sysfs tree.  (Try finding all the authorized
files in /sys/devices/pci<whatever>/, then see which of them would match
this idProduct.)

ATTRS will search up the tree for a matching idProduct attribute, and
will therefore also match any interfaces that this USB device will
create.  But those interfaces won't have an authorized file (since
authorization only works on devices).  I suspect this is the cause of
the error message you copied above.
--
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