Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
2  
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): askubuntu.com/questions/79043/disable-usb-mass-storage –  Takkat Feb 12 '13 at 10:20
add comment

2 Answers

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:

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

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: http://www.ossramblings.com/disabling_usb_storage_in_linux

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
add comment

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
add comment

Your Answer

 
discard

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.