Skip to main content

Lock and unlock your desktop using a USB stick as a key.

Project description


Copyright (C) 2013 Sven Steinbauer

[![Build Status](](

USBlock is a Python script that will lock and unlock your linux box using any
old USB storage device as a key.

** NOTE **
V0.1 only works on Linux. OS X and Windows will have to wait a little.


Install with `pip install usblock` or run `sudo python ./ install`
from the directory you downloaded USBLock into.

See `requirements.txt` for a list of required Python modules.

Non Python dependencies


You will need `dbus` and `python-dbus` as well as `hal`. These should all be
available via your package manager. See below why `python-dbus` is listed here.

Known Issues

* I've had some devices not mount on external USB ports (like on a Mac keyboard
or hub). DBus does not register the device insertion and so USBLock cannot
lock or unlock your machine. Try a different memory stick or USB port.

* On linux you need dbus installed. `pip install dbus-python` doesn't work, so
you may have to install it via your system's package manager or from source.

Thanks for the patches

Joel Semar, Natan L

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for USBLock, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size USBLock-0.2.2.tar.gz (19.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page