How to disable USB ports on Windows, Mac and Linux

Now, you know that using a USB storage device on your computer has many potential security risks. If you fear the risk of being infected with malware, such as trojian, keyloggers or ransomware, you should completely disable the USB storage device if the system has a lot of sensitive data.

Now, you know that using a USB storage device on your computer has many potential security risks. If you fear the risk of being infected with malware, such as trojian, keyloggers or ransomware, you should completely disable the USB storage device if the system has a lot of sensitive data. The article will show you how to disable USB ports on Windows, Mac and Linux.

Disable USB storage device: advantages and disadvantages

If you are worried about the possibility of malware infection on your computer via USB storage device, you should consider disabling this support. However, this job has certain disadvantages.

  1. 5 signs of computer infection with malware

The first drawback is that you cannot use USB storage devices on your computer. If you can use cloud memory easily, this is not a problem. However, if you need a device to exchange data regularly between two computers and cannot use cloud storage, it will be very difficult. You can look at tools like Resilio Sync to create a virtual sharing between PC computers.

If you still want to disable USB storage, the article will guide you through the steps to take on Windows 10, Mac and Ubuntu 18.04.

How to disable USB storage device on Windows

Blocking USB storage devices on Windows computers is very simple. You also have a few options; The first two solutions below are for Windows 10 Home PC.

1. Edit the Registry manually

Open the registry by pressing Win + R , then enter " regedit ".

Picture 1 of How to disable USB ports on Windows, Mac and Linux

Agree to User Account Control notification, then browse to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesUSBSTOR. Here, double-click Start (or right-click, choose Modify ) and edit the value.

Picture 2 of How to disable USB ports on Windows, Mac and Linux

To turn off, change the value to 4. If you need to turn on the USB port again at any time, just change it back to 3, click OK when done. Note that if you are going to change the registry system, you should back up the registry to prevent a problem.

2. Create a registry script

Alternatively, you can create two blank TXT files in Notepad. To do so, launch the text editor and enter the following line:

  1. These "hack" tips are only Notepad can do
 Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesUSBSTOR] "Start"=dword:00000004 [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesUSBSTOREnum] "Count"=dword:00000000 "NextInstance"=dword:00000000 

Save the file as disableusb.reg , make sure to change the .TXT file extension to .REG, otherwise this script will not work. Next, repeat the above process and save as enableusb.reg.

For the second file, edit the line:

 "Start"=dword:00000004 

City:

 "Start"=dword:00000003 

Save the file after it's done. Now whenever you need to disable USB storage device, run the file disableusb.reg. However, any device that has been plugged into the computer will not be affected, until withdrawn. If you need to re-enable the USB storage device, use the file enableusb.reg. Saving files somewhere easy to remember can be found when needed.

Preventing others from using enableusb.reg is not too difficult, you can set up only the administrator account to run the file, as long as you do not share your profile.

3. Use Group Policy Editor

The third option available for Windows 10 Pro and Enterprise is to modify the settings for the USB storage device in Group Policy Editor.

Press Win + R to open the Run dialog box and enter " gpedit.msc ". This will open the Group Policy Editor, then expand Administrative Templates> System> Removable Storage Access . In the right pane, you will see some items that control media access on the computer. You need to activate the following three options:

  1. Removable Disks: Deny execute access
  2. Removable Disks: Deny read access
  3. Removable Disks: Deny write access

Then, double click on each item and click the Enabled button. Click OK to confirm before moving on to the next item.

Now, whenever you plug a USB storage device into your computer, you will receive an Access is denied message on Windows Explorer when trying to open the drive letter. To reverse this, change the three settings above and set to Disabled .

  1. Summary of some simple ways to disable USB ports on Windows computers

How to disable USB storage devices on a Mac

To restrict USB storage devices on a Mac, you first need to disable System Integrity Protection (SIP). Then open Utilities> Terminal and remove the driver.

Note: you should only disable this feature when necessary because many people advise you not to do so, refer to the article Why shouldn't you disable the System Integrity Protection feature on a Mac? for information.

 kextunload /System/Library/Extensions/IOUSBMassStorageClass.kext/ 

Next, open / System / Library / Extensions and rename the file (or move to a safe place) IOUSBMassStorageClass.kext . You should replace something that is easy to remember so you can easily find it when you want to re-enable the USB storage device.

Picture 3 of How to disable USB ports on Windows, Mac and Linux

When you're done, go back to Terminal and enter:

 sudo touch /System/Library/Extensions 

This removes the cache files, forcing the build back without reference to the renamed file. Now, you cannot access USB storage devices when connecting.

How to disable USB storage device on Linux

Need to block a USB storage device on your computer? To do this, open Terminal and use the mv (move) command to 'hide' the USB driver:

 sudo mv /lib/modules/ $( uname -r) /kernel/drivers/usb/storage/usb-storage.ko /home/user1 

Now, when plugged into the USB storage device, it will not work. In short, you cannot access this device. However, this change will no longer work in the case of a kernel update.

Although USB storage devices and portable flash can be password protected, it cannot prevent thieves from stealing your data. The only real solution is USB access control. When staying at home you need to make sure no one accesses your computer without your permission and should lock it when not in use. In the workplace, limit the number of users accessing USB to be manageable.

See more:

  1. Disable USB drives, CD-ROM, Floppy Disk and LS-120 with Group Policy
  2. Summary of some ways to fix USB Device Not Recognized on Windows 7, 8 and 10
  3. 12 USB drives can keep your data safe
Update 25 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile