How can I enable or disable USB ports via the command line in Ubuntu?

vinod May 9, 2011

I want to know how to enable or disable USB ports of the machine through command line in Ubuntu operating system.

  1. omprakash gurjar
    May 5, 2012 at 9:50 am

    please give me USB enabled and disabled form command mod i am use xp operting system

  2. sumit
    April 26, 2012 at 5:51 am

    > > Pl give me the steps how can I do that.
    > >
    > > modprobe -r usb_storage
    > Using above command will work until you reboot the machine.
    > For a permanent solution edit /etc/modprobe.d/blacklist and add following
    > line:
    > blacklist usb_storage
    > then save and reboot.

  3. Sumit
    April 20, 2012 at 12:39 pm

    System -> Administration -> user and groups
    user -> advance setting (authenticate) -> user privileges -> uncheck -
    Access external storage devices automatically

  4. Shantanu
    March 22, 2012 at 6:23 am

    sudo powernap-action --disable usb_autosuspend
    install powernap first

  5. Harryatiekuboateng
    September 29, 2011 at 12:52 pm

    how do i foward my computers activity to my mobile phone...

    • Tina
      September 29, 2011 at 2:13 pm


      interesting question. I'm afraid the chances you will get an answer within this comment thread are slim. Unfortunately, I don't know the answer.

      I recommend that you ask a new question here
      If you decide to submit a question, please share with us what kind of activity you want to forward, how your phone is connected to your computer, what kind of phone (model, mobile operating system) it is, and what operating system runs on your computer. Thank you!

    May 18, 2011 at 12:15 pm

    Hello, you can try the following command on ubuntu's terminal for disabling usb:

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

    To enable usb again just edit the /etc/modprobe.d/blacklist.conf file and remove blacklist usb-storage and then reboot.  Hope it helps

  7. Anonymous
    May 10, 2011 at 3:25 pm

    ubuntu , to view what's connected:
    user@user-desktop:/sys/bus/usb/devices$ for device in $(ls /sys/bus/usb/devices/*/product); do echo $device;cat $device;done


    echo suspend | sudo tee /sys/bus/usb/devices/usb1/power/level

    TO turn back on:

    echo on | sudo tee /sys/bus/usb/devices/usb1/power/level

    if dont work then all you need to do is to run sudo su before trying that command.

  8. Anonymous
    May 10, 2011 at 9:27 am

    Linux Disable USB Devices (Disable loading of USB Storage

    • vinod
      May 10, 2011 at 11:12 am

      This is not working.....

      • Tina
        May 12, 2011 at 12:02 pm


        is the other suggestion working?

        • Vinod
          May 12, 2011 at 1:01 pm

          no... no suggestions are working.

          Do you know the link to chat live with Ubuntu Technical Support Agents.

        • Tina
          May 13, 2011 at 8:31 am


          try this link:

Ads by Google