Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Ubuntu 12.04 and I want to block usb storage on it. What is the correct way to do this?

share|improve this question
When you say you want to block "usb storage", does that mean that you want to prevent external hard drives being connected or do you want to prevent any usb devices connecting to your machine? – Kevin Bowen Feb 12 '13 at 9:07
Related (needs confirmation to work on 12.04): – Takkat Feb 12 '13 at 10:20

In Linux the risk of viruses are small to nonexistent, however USB sticks automatically mount for reading and writing regardless. There's an easy way in recent Ubuntu distributions to disable USB storage devices. Simply blacklist the kernel driver:

echo "blacklist usb-storage" | sudo tee -a /etc/modprobe.d/blacklist.conf

Then update the initramfs

sudo update-initramfs -u

After that, nobody can use a USB memory stick in that computer, but still allows the administrator(s) to manually load the module and use it.

source is here:

Another way which is more selective is to note that users who are members of the plugdev group are allowed to access pluggable storage devices so you could just remove any users you don't want to use USB sticks from that group.

source: here

share|improve this answer
This won't work, because the redirection is performed by the user's shell and isn't affected by sudo. You need to use: echo "blacklist usb-storage" | sudo tee -a /etc/modprobe.d/blacklist.conf – Rory Dec 17 '13 at 10:26
Also the module name is usb_storage not usb-storage – Rory Dec 17 '13 at 10:38
After adding this line, need to run "sudo update-initramfs -u" as… says, right? – Fumisky Wells Mar 28 '15 at 3:00
Its not working at all, usb-storage or usb_storage, both failed to work. Its not correct answer which works. – user1635700 Dec 7 '15 at 6:53

Just rename storage to storage-old:

mv /lib/modules/3.2.0-35-generic-pae/kernel/drivers/usb/storage /lib/modules/3.2.0-35-generic-pae/kernel/drivers/usb/storage-old

change the kernel ver in 3.2.0-35-generic-pae according to yours

share|improve this answer

The simple way Login as root open terminal and type the following command

$ sudo gedit  /etc/modprobe.d/blacklist.conf  it will ask for root password give it . 

then add the blacklist usb_storage at the last line as follows

# really needed.
blacklist amd76x_edac
blacklist usb_storage

Save it and reboot your system.

share|improve this answer
Welcome to Ask Ubuntu, thank you for sharing knowledge. However, your answer does not add new solution. Have you read Warren Hill's answer. – Sneetsher Jun 6 '15 at 10:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.