Results 1 to 7 of 7

Thread: How to block the USB Port in UBUNTU

  1. #1
    Join Date
    Mar 2010
    Beans
    72

    How to block the USB Port in UBUNTU

    Hi all,

    How to block USB Port ( Pen Drive, Memory Card, Hard Disk etc) in UBUNTU Desktop? I need only printer, keyboard and mouse has to work on that particular port.

    Regards

    Lokesh Kamath

  2. #2
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    Re: How to block the USB Port in UBUNTU

    It should be as simple as blacklisting the usb_storage module...
    Code:
    echo "blacklist usb_storage" | sudo tee -a /etc/modprobe.d/blacklist.conf
    Cheesemill

  3. #3
    Join Date
    Sep 2011
    Beans
    Hidden!

    Re: How to block the USB Port in UBUNTU

    Nice!!!

  4. #4
    Join Date
    Mar 2010
    Beans
    72

    Re: How to block the USB Port in UBUNTU

    Thanks...

    I am not yet tested...

    Will test and inform you....

    Lokesh Kamath

  5. #5
    Join Date
    Mar 2010
    Beans
    72

    Unhappy Re: How to block the USB Port in UBUNTU

    Quote Originally Posted by slkamath View Post
    Thanks...

    I am not yet tested...

    Will test and inform you....

    Lokesh Kamath
    Hi,

    I have tested and unfortunately it's not working.

    I have also tested with the code: (some other person posted in the forum)

    At the terminal type

    Code:

    for device in $(ls /sys/bus/usb/devices/*/product); do echo $device;cat $device;done
    This will get you a list of usb devices. You can then turn the power off and on to them like so.


    Turn it off.

    Code:
    echo suspend | sudo tee /sys/bus/usb/devices/XXXX/power/level
    Turn it on

    Code:
    echo on | sudo tee /sys/bus/usb/devices/XXXX/power/level
    Where XXXX is the device to switch off.

    this one also not working.

  6. #6
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    9,018
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: How to block the USB Port in UBUNTU

    Install acpitool and turn off the power to the ports. No power, no go.

    tgalati4@Mint14-Extensa ~ $ acpitool -w
    Device S-state Status Sysfs node
    ---------------------------------------
    1. LID0 S3 *enabled
    2. SLPB S3 *enabled
    3. HDEF S3 *disabled pci:0000:00:1b.0
    4. PXSX S5 *enabled pci:0000:02:00.0
    5. USB1 S3 *enabled pci:0000:00:1d.0
    6. USB2 S3 *enabled pci:0000:00:1d.1
    7. USB3 S3 *enabled pci:0000:00:1d.2
    8. EHC1 S3 *enabled pci:0000:00:1d.7

    Use the -W switch and the number to turn off the power to each device individually.

    Also, can you turn off USB in BIOS?

    Unfortunately acpitool won't work because that only affects wake-from-sleep.
    Last edited by tgalati4; October 19th, 2013 at 03:18 PM.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  7. #7
    Join Date
    Jul 2013
    Location
    Wisconsin
    Beans
    2,298

    Re: How to block the USB Port in UBUNTU

    You can use udev rules for it, too.
    See http://askubuntu.com/questions/44913...in-usb-devices for a good discussion.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •