Disable non-USB drives in linux

Felix Barbalet
2014-04-19T00:43:39Z

disable-non-usb.sh

| #!/bin/bash
|
| for d in $(find /sys/block -type l -name "sd*")
| do
| if [ -z "$(readlink -f $d | grep -i usb)" ]
| then
| echo "$d is a non-USB device, disabling access"
| sudo bash -c "echo 1 > $d/device/delete"
| else
| echo "$d is a USB device"
| fi
| done
|