How to Disable and Enable USB Device in Linux

Here is the interesting tweak about how to disable usb storage device in linux, and only root / sudo users can alone enable / mount it from the terminal. Using the below tweak / method one can block normal / guest user from mounting the usb storage device.

Follow the steps

1) Add this line 

Related Posts Plugin for WordPress, Blogger...

  • pvin

    On Ubuntu 11.04 with lk 3.0.0 this technique does not work. The usb_storage module continues to load.

    • http://www.howopensource.com Manivannan

      Hi dude, Today I checked on Ubuntu 11.04 with Linux Kernel 3.0.0 using VirtualBox and it works fine for me. I have updated the post with screen shots check it. Please write to me if it does not work.

      • http://www.howopensource.com/2011/08/how-to-disable-and-enable-usb-device-in-linux/ chaitanya

        it’s working dude very nice and thank u

  • revathy

    Interesting info… Expecting more such posts!!!!

    • http://www.howopensource.com Manivannan

      Thanks Revathy :)

  • http://www.sathia27.wordpress.com sathia

    great info.

    • http://www.howopensource.com Manivannan

      Thanks Sathia :)

  • http://www.linuxkernel51.blogspot.com GVK51

    The other way i do is, bind or unbind the specific port.

    For example if you have connected a mass storage device : go to the path below

    $ cd /sys/bus/usb/drivers/usb-storage/

    $ ls
    1-6:1.0 bind module new_id remove_id uevent unbind

    here 1-6:1.0 which is a unique id for the device connected this ID is based on the rules set in naming conventions for usb devices.

    now to disable : (mass storage)

    $ echo 1-6:1.0 > unbind

    to enable :

    $ echo 1-6:1.0 > bind

    ( assuming that you are in /sys/bus/usb/drivers/usb-storage)

    Similarly you can do for the any of usb devices based on their classe, like usbhid, usb-serial…. etc,

  • Pingback: usb disable()

  • Suresh

    Hello Dear
    Thanks for your valuable info I am debut Fedora Userwith zero knowledge i have started and now i know very little..I want to install Dosbox 0.74 from its site to play good old DOS games like ‘Dave,’Prince, etc need your help please

  • dnyaneshwar

    hi
    its not working on fedora 14

  • Pingback: How to Disable Amazon search results in Ubuntu 12.10 Dash()

  • Pingback: usb access restriction()

  • kaldesh

    Dude, not all usb devices are storage devices. Your title is misleading…

    • Patrick Mansfield

      +1

  • Frederick Calanao

    the information is gone please help me out. i want to disable usb from my laptop