encrypt your pendrive
Thursday, 13. September 2007 7:33 - daniel - Linux - 0 Comments
encfs is a module for encrypted filesystems in userspace. It doesn't require special permissions and uses the fuse library. And it doesn't use one big encrypted file that spams your regular file system.
I found a little script to manage the mounting and unmounting of the drive. Just put it in the root folder of your pendrive.
Create a folder named .encrypted on the pendrive and a folder named USB in your home dir. Change the ENCDIR and MNTDIR variables to match your setup.
#!/bin/sh
###############################
# Config start
###############################
# The directory on the stick
ENCDIR=".encrypted"
# Where to mount
MNTDIR="/home/daniel/USB"
###############################
# Config ends here
###############################
usage(){
echo basename $0" [m|mount|u|unmount]"
echo " either mounts or unmounts encrypted file system"
}
if [ -z $1 ]; then
usage
exit
fi
case "$1" in
"m" | "mount" )
while ! /usr/bin/encfs $( dirname $0 )"/$ENCDIR" "$MNTDIR"; do
echo -n "Retry "
done;
if [ "$?" -eq "0" ]; then
echo "Encrypted filesystem now mounted"
exit 0
fi
exit 1
;;
"u" | "unmount" )
if /usr/bin/fusermount -u "$MNTDIR"; then
echo "Encrypted filesystem has been unmounted"
exit 0
else
echo "Unmounting failde"
exit 1
fi
;;
* )
usage
;;
esac
Comments