How to disable USB mass storage devices on physical Linux system?

Fig.01: How to disable USB mass storage devices on physical Linux system?

Fig.01: How to disable USB mass storage devices on physical Linux system?

You can disable USB mass storage devices on physical Linux system so that malware can not be installed or user can not move out sensitive data.

How to block USB Storage Devices in Linux

Type the following commands:
Remove usb-storage from running kernel:
# modprobe -r usb-storage
Verify it module is unloaded:
# lsmod | grep -i usb-stroage
List driver file:
# ls -l /lib/modules/$(uname -r)/kernel/drivers/usb/storage/usb-storage.ko
-rw-r--r-- 1 root root 150062 Sep 7 00:28 /lib/modules/4.4.0-38-generic/kernel/drivers/usb/storage/usb-storage.ko

Move usb storage driver to /root/ directory:
# mv -v /lib/modules/$(uname -r)/kernel/drivers/usb/storage/usb-storage.ko /root/
'/lib/modules/4.4.0-38-generic/kernel/drivers/usb/storage/usb-storage.ko' -> '/root/usb-storage.ko'

Verify it:
# modinfo usb-storage
filename: /lib/modules/4.4.0-38-generic/kernel/drivers/usb/storage/usb-storage.ko
modinfo: ERROR: could not get modinfo from 'usb_storage': No such file or directory

This method is known as fake install method.

Examples and usage: Linux Disable USB Devices (Disable loading of USB Storage Driver)

Leave a Comment