Is it possible to disable USB port with known physical location?
Yes, this can be done with just a couple of commands in the terminal:
- Disable the USB port:
echo disabled | sudo tee /sys/bus/usb/devices/usb2/power/wakeup
- Remove power from the port:
echo suspend | sudo tee /sys/bus/usb/devices/usb2/power/level
In the event this doesn’t work, a udev
rule may be necessary:
- Create a new file in
/lib/udev/rules.d
using a text editor of your choice. For example:sudo vi /lib/udev/rules.d/20-block-webcam.rules
- Revoke authorization for the webcam to be accessed:
Looks like the output of# Chicony Webcam SUBSYSTEM=="usb", ATTRS{idVendor}=="04f2", ATTRS{idProduct}=="b330", ATTR{authorized}="0"
lsusb
did matter 😉 - Reboot
From comments:
Also it then maybe fixed by echo 0 | sudo tee /sys/bus/usb/devices/2-1.5/authorized
as per https://www.kernel.org/doc/Documentation/usb/authorization.txt .
Put echo 0 > /sys/bus/usb/devices/2-1.5/authorized
to /etc/rc.local
.