View Full Version : How to setup an encrypted directory in Kali - quick and easy way

2013-04-24, 14:44
There are many encryption tool out in the wild, the purpose here is to use easy and quick way to setup a strong encryption directory on your Kali setup. This directory can be on your home dir (e.g. /root) or on an external USB drive or in the "Cloud".

Here I will show how to create and use an encrypted directory using TrueCrypt command line, you can also use TrueCrypt GUI to achieve the same results (Applications>Accessories>TrueCrypt).

Why TrueCrypt? have look at this comparision table (https://wiki.archlinux.org/index.php/Disk_Encryption#Comparison_table).

Create an encrypted volume which looks like a normal file, however, it is a container for your encrypted files and directory

truecrypt -t -c
Use the default settings unless you know what you are doing or prefer stronger configurations.
(optional) You can have a key file to decrypt your encrypted content, the key file can be stored separately. You can even create multiple key files for a single encrypted volume.
Once done, create a directory say decryptedDir and mount using the following command.

truecrypt -t /PATH/TO/ENCRYPTEDFILE /PATH/TO/decryptedDir
VERY IMPORTANT: Remember to umount the decrypted directory to save back the changes!

truecrypt -t -d /PATH/TO/decryptedDir

I have created the following script to make the life easier. It automatically mounts and umounts the encrypted volume. Remember to set the path for ENC_VOL and ENC_DIR

#This script auto-mounts or umounts truecrypt volume. Pi3cH
#If the volume is not mounted it mounts it, otherwise umounts it.


#check if any volume has been already mounted
truecrypt -t -l
if [ $? == 1 ]
echo "[i] mounting $ENC_VOL"
truecrypt -t $ENC_VOL $DEC_DIR
#if mounted decrypt
echo "[i] umounting $DEC_DIR"
truecrypt -t -d $DEC_DIR

TrueCrypt has been already installed on Kali 1.0. If for some reason you don't have it installed, simply apt-get install truecrypt.
To run truecrypt you need root account which is not an issue in Kali setup! If you wanna have it running under other user account setup, have look at this article (https://wiki.archlinux.org/index.php/TrueCrypt#Mount_volumes_as_a_normal_user).