How To Disable USB Ports In Ubuntu [Quick Tip]

USB Block

Nothing is safe in Cyber world. Even a safe and secure Linux OS like Ubuntu can be hacked in less than 5 minutes. When I was an intern at Mancala Networks, I was working on endpoint protection. One of the things which we wanted to implement in endpoint protection was to disable the USB port. While Linux is (almost) secure from viruses, data theft can occur by means of a removable media.

In this post we’ll see a quick way to disable USB ports in Ubuntu. To this quickly, add anew line in blacklist.conf file. You can use a command like this:

sudo echo "blacklist usb-storage" >> /etc/modprobe.d/blacklist.conf

From next time onwards, no one will be able to use the USB ports. To re-enable the use of USB port, remove the added line from blacklist.conf.

How did you find this quick tip to block USB port in Ubuntu? Do let me know.

Similar Posts

  • This works fine, but if you leave the USB storage device in the port and restart the system, the USB storage will be automatically detected. Using 20.4. Any solutions for this ?

  • Hello Linuxian, I have tried it but dosen’t work. I think should replace it as below
    sudo echo “blacklist usb_storage” >> /etc/modprobe.d/blacklist.conf

    • I haven’t tried it myself, but yo may have a typo, being usb-storage instead of usb_storage (note the underscore)