I can give you a Linux solution. Firstly, you'll need to use this script to lock your screen; secondly, this only disables usb storage devices
#!/bin/sh
sudo modprobe -r usb_storage
gnome-screen-saver --lock
You can modify this to totally disable the usb stack - you'll need to modprobe -r
on ohci
, xhci
and ehci
and any other prefixes to hci
you can find. In my kernel, these are baked into the core binary, so there is nothing I can do to remove them from the kernel.
Be aware that removing those host controllers will also totally wipe out your usb keyboard and mouse - so ensure you're running serial.
You can also do this the hard way - i.e. no support at all, using the techniques here or by totally removing the relevant controllers from the kernel.
As to whether this can be done on Windows - from looking, not so easily. You can disable USB storage classes using something akin to this method - and you can definitely lock the screen from a script using Rundll32.exe User32.dll,LockWorkStation
. However, I suspect a dedicated solution for this would be best.
On the likelihood of USB cloning devices actually working - well the USB spec simply defines a bus. At the host end, you need device drivers capable of communicating with the device for it to work. These exist for mass storage devices, obviously, however, in order to automatically install drivers you need Windows - Linux has no such autorun capability (that I know of). However, Windows does. In which case, a simple solution would be:
- Turn off autorun. Windows will then not run any applications automatically on inserting a USB device.
- Turn off automatic driver installation. To do this, go to run and type
gpedit.msc
. Go to Computer Configuration, Administrative Templates, System, Device Installation, Device Installation Restrictions. From here, you can totally disable driver installation - "Prevent installation of devices not described by other policy settings" will do exactly this. (source).
Under these circumstances, there would be no way for an inserted USB device to actually initiate a copy of your disk assuming no bugs in the USB device drivers that could be exploited for this purpose (very, very unlikely).
(Not that I'm paranoid, but I tend to run systems I care about with device driver installation blocked anyway, just for good measure. Also, UAC these days, along with driver signing if you're using x64 Windows, should prompt before installing a driver, so you should be good. But just in case...)