Skip to content

Instantly share code, notes, and snippets.

@oxyc
Created August 29, 2011 09:04
Show Gist options
  • Save oxyc/1178052 to your computer and use it in GitHub Desktop.
Save oxyc/1178052 to your computer and use it in GitHub Desktop.
Automount encrypted USB drive containg ssh keys.
# Based on several guides, primarily:
# http://ninetynine.be/blog/2009/03/ubuntu-backup-to-usb-drive-on-mount/
# /etc/udev/rules.d/81-local.rules
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="…", ATTRS{idProduct}=="…", RUN+="/usr/bin/truecrypt_mount.sh"
ACTION=="remove", SUBSYSTEMS=="usb", ATTRS{idVendor}=="…", ATTRS{idProduct}=="…", RUN+="/usr/bin/truecrypt_unmount.sh"
# /usr/bin/truecrypt_mount.sh
truecrypt /dev/disk/by-id/… -k … --protect-hidden=no --password= /mnt/houdini/
# /usr/bin/truecrypt_unmount.sh
truecrypt -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment