To block USB in Linux
touch /etc/modprobe.d/disable-usb-storage.conf
echo "install usb_storage /bin/true" >> /etc/modprobe.d/disable-usb-storage.conf
to check usb is attach, if attache it remove
lsmod | grep -i usb_storage
now (after remove usb)
modprobe -r usb_storage;
To reenable usb
rm /etc/modprobe.d/disable-usb-storage.conf
touch /etc/modprobe.d/disable-usb-storage.conf
echo "install usb_storage /bin/true" >> /etc/modprobe.d/disable-usb-storage.conf
to check usb is attach, if attache it remove
lsmod | grep -i usb_storage
now (after remove usb)
modprobe -r usb_storage;
To reenable usb
rm /etc/modprobe.d/disable-usb-storage.conf