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

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 , , .
Join live MakeUseOf Groups on Grouvi App Join live Groups on Grouvi
Computer Hardware Talk
Computer Hardware Talk
483 Members
Linux Tips & Issues
Linux Tips & Issues
418 Members
Linux for Beginners
Linux for Beginners
360 Members

Comments for this Question are closed.

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


      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!


    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

    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.

  • Anonymous

    Linux Disable USB Devices (Disable loading of USB Storage

Ads by Google
New comment

Please login to avoid entering captcha

Log In