How can I enable or disable USB ports via the command line in Ubuntu?
Question by vinod /

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

Browse other questions & answers in the category ; tagged , , ; or ask your own question.

Comments for this Question are closed.

If you are looking for help, please ask a new question.

We will be happy to help you!

Answers (13)
  • omprakash gurjar

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

  • sumit

    > > 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.

  • Sumit

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

  • Shantanu

    sudo powernap-action –disable usb_autosuspend
    install powernap first

  • Harryatiekuboateng

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

    • Tina

      Harry,

      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: http://www.makeuseof.com/answers
      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!

  • FIDELIS

    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

  • Anonymous

    In
    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

    Disconnect

    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
    http://www.learnosity.com/techblog/index.cfm/2008/3/10/Power-saving-tips-for-Ubuntu-on-laptops

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

  • Anonymous

    Hi
    Linux Disable USB Devices (Disable loading of USB Storage
    Driver)http://www.cyberciti.biz/faq/linux-disable-modprobe-loading-of-usb-storage-driver/