Results 1 to 6 of 6

Thread: How to block the USB Port in UBUNTU

  1. #1
    Join Date
    Mar 2010
    Beans
    154

    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
    154

    Re: How to block the USB Port in UBUNTU

    Thanks...

    I am not yet tested...

    Will test and inform you....

    Lokesh Kamath


    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.
    Last edited by howefield; September 22nd, 2016 at 08:20 AM. Reason: posts combined.

  5. #5
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,044
    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.

  6. #6
    Join Date
    Jul 2013
    Location
    Wisconsin
    Beans
    4,952

    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
  •