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. 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 ".

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

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.

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

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.

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

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
3.6 ★ | 22 Vote

May be interested

  • Most cyber attacks focused on these 3 TCP ports onlyMost cyber attacks focused on these 3 TCP ports only
    small and medium-sized businesses can fully protect themselves from most cyber attacks by increasing defenses against ports that are most often targeted by malicious actors.
  • How to set up or disable Linux Mint update notificationsHow to set up or disable Linux Mint update notifications
    are you annoyed with linux mint software update notifications constantly appearing on the screen? adjusting or disabling update notifications on linux mint is very simple.
  • 7 ways to run Linux software on Windows7 ways to run Linux software on Windows
    linux users want to run windows software on linux, whereas windows users want to use linux software. even if you are looking for a better development environment, more powerful command-line tools, you can run linux software without removing windows.
  • How to set up a firewall in LinuxHow to set up a firewall in Linux
    you should set up a firewall to prevent others from accessing your computer and protecting you from network attacks. in today's article, you will learn how to set up firewalls in linux and add rules to allow access to other devices on a local network or specific ports.
  • 8 main differences between Windows and Linux8 main differences between Windows and Linux
    is linux and windows the same? linux is different from windows? that is the question that many people wonder when they first come into contact with the linux operating system. in this article we will help you answer that question.
  • Linux Removes Outdated, Insecure USB Network Protocol Still Present on WindowsLinux Removes Outdated, Insecure USB Network Protocol Still Present on Windows
    greg kroah-hartman, a member of the linux foundation, seems ready to disable the rndis usb protocol driver once and for all.
  • How to disable and remove LightDM on LinuxHow to disable and remove LightDM on Linux
    want to experiment with other display managers? or maybe your proprietary graphics driver conflicts with lightdm.
  • Convert data, applications from Windows to Linux in minutesConvert data, applications from Windows to Linux in minutes
    many people want to use both windows and linux operating systems that perform dual booting, but recently a problem with windows drivers has made users frustrated and annoyed, so they can only use linux operating system.
  • How to disable the Insert key in Windows 10How to disable the Insert key in Windows 10
    when you accidentally press insert on the keyboard, it switches to overtype mode, overwriting the text behind the cursor. luckily, you can disable this annoying key in windows 10.
  • Disable Windows 10 keyboard in 5 simple waysDisable Windows 10 keyboard in 5 simple ways
    for some reason you want to disable the keyboard on your windows computer. for example, you are watching an episode and you do not want someone to accidentally press the button on the keyboard and reload from scratch or reuse it. you can then disable the keyboard on your windows computer.