- First, get an ssh session to the machine, just in case we accidentally block our keyboard.
- Plug in a USB drive to the port you want to restrict.
- Run
lsblk
to find the device name (e.g./dev/sdd
), you can check by size. - Verify this by running
ls -l /dev/disk/by-id
, the device ID/name should point to the/dev/sd*
you identified in the previous step. - Now, run
ls -l /dev/disk/by-path
, and check which path points to the device. (Note, you need this for the step 1 of the StepMania USB profiles setup as well.) This should look something likepci-0000:06:00.3-usb-0:3:1.0-scsi-0:0:0:0
. Remove the-scsi-0:0:0:0
and we're left with a "path" likepci-0000:06:00.3-usb-0:3:1.0
. - To create the actual rule, create a file called
/etc/udev/rules.d/99-restrict-usb-storage.rules
, and add this line: