-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 #!/bin/sh # truecrypt.sh - A wrapper for the *NIX port of Truecrypt # (http://www.truecrypt.org/) to make it simpler to use as an # unprivileged user. # # Specifically, I wrote this script to scratch a personal itch, which # involved (un)mounting Truecrypt datastores kept on USB keys used on a # number of different systems. # # This script assumes that sudo is installed, and that the user you'll be # accessing the volume through has limited access to mount and unmount # Truecrypt volumes. To do this, the following line must be placed in the # /etc/sudoers file: # %truecrypt ALL=(root) NOPASSWD:/usr/bin/truecrypt # Revision: v1.0. Initial release. # Variables # Determine the UID and GID to pass to the truecrypt utility. MOUNT_UID=`id | awk '{print $1}' | sed 's/uid=[0-9]*(//' | sed 's/)//'` MOUNT_GID=`id | awk '{print $2}' | sed 's/gid=[0-9]*(//' | sed 's/)//'` # Here's where the heavy lifting happens - this parses the arguments passed to # script and executes the truecrypt binary with the appropriate arguments. case "$1" in 'mount') sudo truecrypt -M uid=$MOUNT_UID,gid=$MOUNT_GID $2 $3 exit 0 ;; 'unmount') UNMOUNT_DIR=`echo $2 | sed 's/\/$//'` sudo truecrypt -d $UNMOUNT_DIR exit 0 ;; 'status') mount | grep 'mapper' exit 0 ;; *) echo "USAGE:" echo " Mounting: $0 mount /path/to/datastore /mntpoint" echo " Unmounting: $0 unmount /mntpoint" echo " Status: $0 status" echo exit 1 esac exit 0 # End of script. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7-ecc0.1.6 (GNU/Linux) iD8DBQFHKfTgO9j/K4B7F8ERAgleAKDg4g4LKzZ8OLr/lkbKcLiwAW29+QCg99U3 CrkrIX1tf6ABhHsBR5IRDvk= =39V3 -----END PGP SIGNATURE-----