Activities

October 2009
M T W T F S S
« Aug   Nov »
 1234
567891011
12131415161718
19202122232425
262728293031  

How to disable usb storage device on Linux

As some of them can easily disable usb device port either by disabling it on BIOS or applying registry patch on Windows.

But it’s difficult to block a device on linux. But after some google research give me answer. My tricks are,

How to disable the USB storage device on Linux box
Edit

vi /etc/modprobe.conf

and added the entry

install usb_storage wall "Critical device malfunction! Drive will be formatted"

File (/etc/modprobe.conf) will look like this after the alteration

alias scsi_hostadapter sata_via
remove snd-via82xx { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-via82xx
install usb_storage wall "Critical device malfunction! Drive will be formated"
alias usb-controller ehci-hcd off
alias usb-controller1 uhci-hcd  off
alias eth0 via-rhine
alias snd-card-0 snd-via82xx
options snd-card-0 index=0
options snd-via82xx index=0

Don’t forget to add the line modprobe -r usb_storage in /etc/rc.local to keep the settings on each reboot.

cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
modprobe -r usb_storage
touch /var/lock/subsys/local

We cam customize the messages what you wish to display.

Disabling USB storage on Fedora and Ubuntu

If you want to disable the same on either Ubuntu or Fedora, follow the instructions as shown below,

a. Edit the file /etc/modprobe.d/blacklist.conf
b. Add the line blacklist usb_storage
c. Edit the file “/etc/rc.local” and add the line “modprobe -r usb_storage”

Thanks Arun G Toms for pointing this :-).

-enjoy

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>