External storage devices , such as pen drives, flash drives, and USB hard drives could be dangerous for the security of your system and your privacy. These can be used to infect with malware and to steal sensitive information from your computer. That is why it is good to know how we can block or disable USB storage to prevent your ports from being used by unauthorized people while you are away. Below I will show you one way to do it.
You can disable and enable access to USB mass storage using the Windows registry, and considering that only an account with administrator privileges can modify the registry, this method can be successful in most cases.
Disable USB storage in Windows Registry
To disable USB mass storage through the Windows Registry, you must follow the following steps:
- Open the Registry editor, which we can do by typing regedit in the search bar of the start menu or with the Run command.
- We navigate through the string HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ USBSTOR.
- We look for the Start key .
- We change the Start data to 4 to disable USB storage.
- If we want to re-enable the USB storage, we change the Start data to 3 again.
Make everything easier…
We can do all of the above in an easier and more accessible way. For this we are going to create two files in Notepad, and we will name them disableUSB.reg and enableUSB.reg respectively (the name does not affect its operation, we only call it that to identify them).
Create disable USB.reg
We open a Notepad and copy the following code:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ USBSTOR] �Start� = dword: 00000004 [HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ USBSTOR \ Enum] �Count� = dword: 00000000 �NextInstance� = dword: 00000000
Now we save the file with the name disableUSB.reg, making sure that we save it with the extension REG and not TXT. The file should look like the following image:
Create enable USB.reg
We must copy the same code to another Notepad, with the variation in the line that says “Start” = dword: 00000004, we replace the 4 with 3. We save the file with the name enableUSB.reg, being as follows:
Having saved these files somewhere convenient on the system. Running or opening disableUSB.reg and confirming the change will disable the USB storage by modifying the Registry. With enableUSB.reg we rehabilitate access to storage.
But how do we prevent other people from using these files? This is easy, since only accounts with administrator privilege can make changes to the registry. Assuming that you are the only one who has administrator permission and that no one else has your user password, you will be the only one capable of running these files.