Page 1 of 1

disabling USB ports

PostPosted: Nov 29th, '17, 10:12
by magfan
How can I disable USB ports for specific users? They should not be able to connect external devices to the system.

Re: disabling USB ports

PostPosted: Nov 29th, '17, 13:15
by wintpe
its along the same lines as the power management disable of usb ports that i discussed in the basic forum.

viewtopic.php?f=7&t=12136

lsusb, identify what ports you want to disable.

then traverse the /sys filesystem to find all the releated usb modules.

then , as an example, not necessarily an exact solution to your problem.

echo -n "0000:00:12.0" > /sys/bus/pci/drivers/ohci_hcd/unbind

you could add to that , again referring to the other thread a systemd script to run on bootup to add this line.

beware some usb ports may be used for keyboard/mouse.

regards peter

Re: disabling USB ports

PostPosted: Nov 29th, '17, 14:11
by magfan
I do not want to disable some USB ports completely. A few users should still be able to use USB ports. Other users like "guest" should not be able to use them.

Re: disabling USB ports

PostPosted: Nov 29th, '17, 19:47
by doktor5000
If the device nodes are not tied to a specific system group by default, then you might only be able to distinguish between root and all other users.
See e.g. https://askubuntu.com/questions/887339/ ... untu-16-04
or https://unix.stackexchange.com/question ... n-a-debian

Otherwise you probably need to adapt the default udev rules for all USB devices to make them only accessible for some group that other users are part of but where guest is not a member of.