Despite the many advantages of USB storage devices, there is a major downside called "security". Some users can use this tiny and portable device to copy sensitive data or fill your computer with viruses and spywares.
To prevent unauthorized data transfers via USB storage devices on Ubuntu or Debian, you can follow the instructions given below to disable USB ports of your computer.
1. Under Ubuntu or Debian-based system, open the Terminal and edit this file:
sudo gedit /etc/modprobe.d/blacklist.conf
sudo nano /etc/modprobe.d/blacklist.conf
2. Add now the following two lines:
# Block access to USB
3. Save the file and close it, then restart your system. Your USB ports are now disabled.
4. To enable USB ports, repeat the same steps and in step2, comment the "blacklist usb_storage" line as follows:
# blacklist usb_storage