I am turning my raspberry pi prototype device into a market product. The data and the program running on the pi must be protected. But we have a USB webcam attached to it (provided by us, hence we know its details, id, etc). So I want to ensure that the end-user doesn't plug anything (keyboard, mouse, pen drives, etc) into the USB port except that particular webcam. How can I accomplish this?

Note: I don't want the overhead labour of desoldering the USB port and connector, and soldering the webcam's bare wires on to the pi. That would be the last resort.

  • 2
    This may help: unix.stackexchange.com/questions/63199/…
    – Craig
    Commented Jan 7, 2019 at 21:45
  • Hot glue is probably easiest. Glue your camera to your RPi. Glue a blank USB plug into the other three sockets to prevent anything alien being inserted.
    – Dougie
    Commented Jan 7, 2019 at 23:06
  • @Craig Thanks! That was exactly what I had been looking for. Would it disable ethernet access over USB as well (through a USB data cable)? If yes, can you please post it as an answer so that I can mark it as correct?
    – Mythos
    Commented Jan 8, 2019 at 20:02

1 Answer 1


udev rules are probably the best way to handle this. This answer is probably a good starting point.

Basically you would create a rule that matches all devices except yours and have udev disable the device when it is added.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.