
What USB Restricted Mode does on iPhone and iPad, how to turn the accessories setting on or off, whether it affects charging, and what it means for IT.
How to disable USB ports or block USB storage on Windows, Mac and Linux: Group Policy, registry, MDM, BIOS and USBGuard, with keyboards still working.


Content writer, trio.so
Most of the time you do not need to disable USB ports at all: you need to block USB storage, so flash drives and external disks stop working while keyboards, mice, headsets and security keys keep working. On Windows, turn on the Group Policy setting "All Removable Storage classes: Deny all access" (under Computer Configuration, Administrative Templates, System, Removable Storage Access) or push the same setting from an MDM. On a Mac there is no built-in switch; use an MDM restriction (the Disk Management setting on macOS 15 and later) or an endpoint security tool. On Linux, stop the usb-storage and uas kernel modules from loading, or use USBGuard to allow only approved devices. Turning ports off completely, in Device Manager, the BIOS or with physical locks, is for kiosks and high-security machines.
If one laptop needs locking down today, jump to your operating system below; if an audit asked you to stop data leaving through USB drives on every PC, the best practices and fleet sections are for you.
USB drives are one of the simplest ways for data to leave a company and for malware to come in. A file copied to a flash drive bypasses email filters and cloud sharing controls, and a drive found in a car park and plugged in by a curious employee is still a working attack. Preventing USB data exfiltration is a common audit finding, and a frequent reason teams look for this guide.
It helps to separate two jobs before you change anything:
Both can be undone, but test on one machine first. The quickest way to cause a support ticket is to disable the ports on a desktop whose keyboard is USB.
Group Policy is the cleanest way to block USB storage on Windows because it covers every removable storage class and leaves other USB devices alone.
gpedit.msc and press Enter (for a domain, edit a Group Policy Object in Group Policy Management instead).gpupdate /force, then unplug and reconnect any drive to check it is blocked.The setting takes precedence over the individual removable storage settings in the same folder. If you want read-only instead of a full block, leave it off and enable Removable Disks: Deny write access instead, which lets users open files from a drive but not copy anything to it. The same settings exist under User Configuration if you want them to apply to certain users rather than the whole computer.
Windows Home has no Group Policy Editor. Use the registry method below or an MDM.
The USB mass storage driver can be stopped from loading by changing its start value. Run this in an elevated Command Prompt or PowerShell:
reg add "HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t REG_DWORD /d 4 /f
4 disables the driver; set it back to 3 to allow USB storage again. Reconnect the drive or restart for it to take effect. Two limits to know: many newer fast USB drives use the USB Attached SCSI driver (UASPStor) instead of USBSTOR, so this method alone may not block them, and anyone with admin rights can change the value back. The Group Policy setting avoids the first problem, and taking local admin rights away from users avoids the second.
In Device Manager (devmgmt.msc), expand Universal Serial Bus controllers, right-click a USB Root Hub or host controller and choose Disable device. Every device on that controller stops working, including keyboards and mice, and a Windows update or a driver reinstall can turn it back on. Use it only for a single machine where you want the ports dead and have another way to control it.
If some people must use USB drives, Windows can allow specific devices while blocking the rest. Under System > Device Installation > Device Installation Restrictions, the policies to prevent installation of devices not described by other settings, and to allow devices that match given device IDs, let you approve particular drive models. Endpoint security products with device control can go further and allow individual drives by serial number. Pair any exception with encrypted drives, for example BitLocker To Go.
macOS has no setting in System Settings that blocks USB drives. Your options:
The iPhone and iPad equivalent, which stops accessories connecting while the device is locked, is covered in USB Restricted Mode.
USB drives on Linux use the usb-storage kernel module, and many newer drives use uas. A blacklist line alone only stops automatic loading; an install line stops the module from loading at all. Create a file in /etc/modprobe.d/:
# /etc/modprobe.d/disable-usb-storage.conf install usb-storage /bin/false install uas /bin/false blacklist usb-storage blacklist uas
Then unload the modules if they are already loaded (unplug any drives first), and rebuild the initramfs so the rule applies at boot:
sudo modprobe -r uas usb-storage sudo update-initramfs -u # Debian and Ubuntu sudo dracut -f # Fedora and RHEL
Keyboards and mice use different modules, so they keep working. Remove the file and rebuild the initramfs to undo it.
USBGuard blocks every USB device that is not on its allow list, which makes it the Linux tool for "these devices only". Generate a policy from the devices plugged in now, so your keyboard and mouse are allowed, before you start the service:
sudo apt install usbguard # or: sudo dnf install usbguard sudo sh -c 'usbguard generate-policy > /etc/usbguard/rules.conf' sudo systemctl enable --now usbguard usbguard list-devices # shows allowed and blocked devices
New devices are then blocked until you add a rule for them. Starting USBGuard without generating the policy first can lock out a USB keyboard.
For a quick, temporary block of one device or port, write 0 to its authorized file, for example echo 0 | sudo tee /sys/bus/usb/devices/2-1/authorized (find the path with lsusb -t). It does not survive a reboot, so it is for testing, not policy. For user management on the same machines, see Linux user management best practices.
Reverse whichever method was used: set the Group Policy setting back to Not Configured, set the USBSTOR start value to 3, remove the Linux modprobe file, or re-enable the controller in Device Manager. If your company manages the device, the setting comes from IT and will come back after the next policy refresh, so ask IT for an exception rather than changing it yourself.
Changing Group Policy on a domain works for PCs that reach a domain controller; laptops that never come to the office need the setting pushed another way. trio.so blocks USB drives and other removable storage on Windows PCs with a removable storage policy, and blocks USB storage on Linux devices with its restrictions policy, so one setting reaches every enrolled machine. See policy management.

Related reading: enabling Remote Desktop with Group Policy and data loss prevention.
trio.so blocks USB drives and other removable storage on Windows PCs with one policy.
trio.so brings device management, patching and security policies for Windows, macOS, Linux, iOS/iPadOS and Android into one console. Enroll a device and see it in the console within minutes.
trio.so brings device management, patching and security policies for Windows, macOS, Linux, iOS/iPadOS and Android into one console. Enroll a device and see it in the console within minutes.





usb-storage and uas modules. On a Mac, use an MDM's external storage restriction. All three leave keyboards and mice working.gpupdate /force to apply it.Related
The related industry news, interviews, technologies, and resources.

What USB Restricted Mode does on iPhone and iPad, how to turn the accessories setting on or off, whether it affects charging, and what it means for IT.

What BitLocker drive encryption is, how TPM, PIN and recovery keys work, Windows 11 Home vs Pro, and how IT turns it on and keeps keys safe at scale.

What endpoint hardening is, a checklist by area for Windows and Mac, CIS Benchmarks as a baseline, and how to apply and check hardening across a fleet.

EDR vs MDM: what each one does, where they overlap, why most teams run both, and how they share data to find and fix risky devices faster.

How MDM manages certificates on iPhone and iPad: the APNs push certificate, SCEP and PKCS identity certificates, trusted roots, renewal and revocation.

What unauthorized access to a computer system is, the seven ways attackers get in, how to spot it, and a checklist to prevent it on devices and accounts.

What defense in depth means, the five layers from perimeter to people, how it differs from layered security, and how to apply it in a small IT team.

Are you guarding mobile data from threats? Data exfiltration prevention in MDM ensures secure encryption, controlled access, and active monitoring.
14-day free trial. No credit card required.
trio.so for MSPs: one console, separate clients