View Full Version : [ubuntu] How to block the USB Port in UBUNTU
slkamath
June 27th, 2013, 04:07 PM
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
Cheesemill
June 27th, 2013, 04:20 PM
It should be as simple as blacklisting the usb_storage module...
echo "blacklist usb_storage" | sudo tee -a /etc/modprobe.d/blacklist.conf
Herbon
July 8th, 2013, 01:32 PM
Nice!!!
slkamath
July 9th, 2013, 05:05 AM
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.
tgalati4
October 19th, 2013, 03:15 PM
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.
ian-weisser
October 19th, 2013, 06:29 PM
You can use udev rules for it, too.
See http://askubuntu.com/questions/44913/can-udev-be-used-udev-rules-to-whitelist-certain-usb-devices for a good discussion.
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.