I've already searched for an answer, but can not find exact solution for this task.
I'm new to Linux but I want to learn and I want to know how to disallow any usb device type except flash drive inserted in specified USB port.
I know how to write matching rule for udev but I can't find real example of a script that will block specified USB port on udevadm
event.
At first I created a rule /etc/udev/rules.d/96-myusb.rules
to match usb device type:
ACTION=="add", SUBSYSTEM=="usb", ENV{ID_TYPE}!="disk", ENV{ID_USB_DRIVER}!="usb-storage",RUN+="/lib/udev/unmount.sh"
Please correct me if I wrong.
Then I have to write a shell script that will be executed by the previous rule to block unmatched devices on specified USB port — and this is the problem for me.