Pages

How to Disable/Enable USB port in Windows/Linux/Mac


    Administrators sometimes have to disable the USB port to prevent unauthorized copying of files and viruses/worms spreading through removable media. Disabling a USB port can be achieved in two ways either through the BIOS or through OS settings. Today I am discussing about the OS tweaks to disable USB ports.



    Disabling/Enabling USB in Windows via Registry

    ·         Click on Start.
    ·         Click on Run.
    ·         Type regedit. This will launch the Registry Editor.
    ·         Navigate to  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbstor.  
    ·         In the work area, double click on Start.
    ·         Change the value to 4.
    ·         Click on OK.
    ·         Close Registry Editor and refresh your desktop.
    ·         To re-enable access to your USB ports, Change the value to 3 .





    Disabling/Enabling USB  in Linux

    •  Edit /etc/modprobe.d/blacklist.conf
    • eg: sudo VI /etc/modprobe. d/blacklist. conf
    • Add  blacklist usb_storage at the end of the line. Check the below sample screen shot.
    • Press a to insert  , :qw to save the changes.

    • Edit /etc/rc.local eg: sudo vi /etc/rc.local and add the following line modprobe -r usb_storage
    • For Debian based distributions add it before exit 0.For redhat based distributions add it before touch /var/local/subsys/local.

    • Restart your system.


      To enable or mount the device

      Open terminal and type this command
      sudo modprobe usb_storage

      To unmount

      sudo rmmod usb_storage


      Disabling/Enabling in  Mac OS


      ·         Log on with an administrator account
      ·         GOTO Terminal
      ·         Rename the file name IOUSBMassStorageClass.kext from terminal sudo mv /System/Library/Extensions/IOUSBMassStorageClass. kext / IOUSBMassStorageClass. kext. backup
      ·         Reboot the machine.

      To Enable

      Rename IOUSBMassStorageClass.kext.backup to Original .