In general, malware programs are built with the feature to run automatically. An autorun.inf file, located in the USB drive, can execute files as mentioned in the .inf file. So if any of the USB drives are infected with malware, it’s clear you’re infected when you insert it into the machine. Therefore, it is tough to prevent your computer from infection. So you should disable the autorun property.
Turn off the Autorun feature
- Press Windows + R to open a Run dialog box. Type gpedit.msc in the start menu’s ” Run ” dialog and press ” Enter“
- Navigate to Computer Configuration> Administrative Templates> System.
- In the right pane, find the entry ” Turn off Autoplay ” and double click on it.
- In the ” Settings ” tab, select ” Enable ” and then select ” All drives “.
- Click ” Apply ” and ” Ok “.
By disabling the Autorun property, you can feel more secure. But still, if you don’t want any risk of virus infection via any USB drive, then you can disable your USB port.
Disable USB ports from certain users
If you want to prevent your friend from connecting any USB drives to your laptop or PC, then you will have to create another user account in Windows and gain access to the USB port from any account.
- Open the registry editor from the ” Run ” dialog box of the Start menu type ” Regedit ” there.
- Now navigate to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesUsbStor
- In the right pane, double-click ” Start ” and change the value from 3 to 4.
This will gain access to another user’s USB port. If you want to re-enable it, then return the value in 3.
Disable USB port
If you don’t want to edit the registry, you can physically disable the USB port. That means anybody cannot transfer data to your computer’s USB ports, including yours, until the ports are enabled. You can physically disable the USB port in the following ways:
- Open Device Manager by right-clicking My Computer> choose Manage> to select Device Manager in the left pane.
- Find the ” Universal bus controller ” item in the right pane and expand it by clicking on the ” + ” icon.
- Find out the entry that represents your USB port. Generally, it is ” USB Root Hub “. Now right-click on it and choose ” Disable “.
Disable USB port from your BIOS settings
Enter your BIOS before starting your computer by pressing F10 or as your computer’s parent board supports. Disable the USB port from there and set a BIOS password so that anyone can’t change the BIOS settings if you don’t have one.