USBKill Powers Off Your Computer in Emergency

USBKill is a small and simple Python script that can turn off your Linux or Mac computer as soon as you attach or remove a USB pen drive in your computer. According to the author of this tool, it could be needed when you are doing something along the lines of the investigative journalism. In some places of the world, whistle blowers, activists, and investigative journalists are under constant threat for what they do. You can understand all this if you have watched the movie All The Presidents Men (1976) which is based on the true story of two investigative journalists who exposed what later became to be known as the Watergate scandal.

The author of the USBKill says that when thugs or other people come looking for such journalists or activists, they seize the running computers and use something called mouse jiggler to keep the OS from sleeping or locking up. This mouse jiggler device keeps sending mouse event signals to the operating system to make it think that computer is in use and not idle – this preventing it from entering sleep mode or starting the password protected screen savers etc.

To prevent these people from using your running computers and find out what you have been doing, a quick approach is to just turn off the computer. This is what USBKill does. You have to run the script which works only on Mac and Linux. Under Linux, you can give the command sudo python to run the script.


After this the script will monitor your system for any changes in the USB mass storage devices. When you attach a new mass storage USB device or remove such a device, then the script instantly sends the power off command initiating the computer shutdown.

While this approach in itself is not enough but when combined with other basic privacy measures like using the incognito mode of web browsers or using Live Linux disks for all your investigative work, all your temporary data disappears in thin air as soon as your PC shuts down.

Conclusion: USBKill is a simple Python script that turns off your computer as soon as you attach or remove USB pen drives. This can be useful when you want to instantly turn off the PC under special circumstances.

You can download USBKill from

One comment

  1. Is there a way to get the program to allow insertion of certain usb drives without having to restart it?

Comments are closed.