0

This question already has an answer here:

I want to disable a particular USB storage device (a sandisk flash drive). I read somewhere that you can use the .config file. How do i use it to disable that?

marked as duplicate by karel, Eric Carvalho, Fabby, Charles Green, David Foerster Dec 24 '17 at 0:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • This sounds like an X-Y Problem. What are you actually trying to achieve? If you want to ban specific device ID for its security impact an attacker could always use a different device with the same functionality. – David Foerster Dec 24 '17 at 0:33
0

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.

To enable again simply remove the line from the blacklist file.

1

First :

You can disable it from Bios setting and make bios password protected .

Second:

You can get rid of all USB devices by disabling kernel support for USB via GRUB.

kernel /vmlinuz-2.6.18-128.1.1.el5 ro root=LABEL=/ console=tty0 console=ttyS1,19200n8 nousb
  • the thing is i'm learning things.. so i want to see how this .config file and grub.cfg file work.. thats why i wanted to know how can i use that file to do stuff.. and i am unable to access my flash drive now.. – akshay Mar 6 '14 at 9:09
0

The best way is to use udev blacklisting (using the authorized feature in sysfs) so you can be very selective (since you want a specific device). You can find a very interesting article about this here

With .config you could totally disable usbstorage module but this would then make any usb storage not work anymore.

  • Actually there's been a problem. I'm not able to access any flash drive i'm insterting. When i tried insmod/modprobe usb-storage, it said FATAL: usb-storage not found! I dont even remember "rmmod"ing it! – akshay Mar 6 '14 at 6:06
  • That sounds strange. Did you recompile the kernel maybe and not install it or configure it? Well try anyway to see if there is: find /lib/modules/`uname -r`/kernel/drivers/ -name "*storage*" – fede.evol Mar 6 '14 at 6:22
  • yea.. just to learn, i customized the kernel and recompiled.. i even checked in the make menuconfig.. the usb-storage is marked "m"! and for he above command its showing g_mass_storage.ko – akshay Mar 6 '14 at 8:30
  • oh and btw, when i try to insmod g_mass_storage, it says "unknown symbol in module" – akshay Mar 6 '14 at 9:07
  • g_mass_storage is for "usb gadget" which is something totally different sorry. – fede.evol Mar 6 '14 at 10:02

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