Mounting a TrueCrypt volume from the command-line

If you are reading this post, i’m assuming that you know about TrueCrypt and that you already have an encrypted volume created. Sometimes i’m much faster using just the command line, so i wanted to access my encrypted volume quickly. 

How to mount a volume – it will prompt you for a password


truecrypt /path/to/encryption/file /path/to/mount/volume


truecrypt /home/user/backupfile /media/truecrypt1

How to mount a volume with a key file


truecrypt /path/to/encryptionfile -k /path/to/key /path/to/mounting/location


truecrypt /home/user/backupfile -k /home/user/folder/backupkey /media/truecrypt1

How to dismount a volume

truecrypt –dismount /media/truecrypt1

Make things faster

One way you can make things happen faster is by using aliases.

alias opensesame=”truecrypt /home/user/backupfile -k /home/user/folder/backupkey /media/truecrypt1″

alias closesesame=”truecrypt –dismount /media/truecrypt1″

Now you can run the whole command just by typing the alias name, in this case – opensesame and after that closesesame. Note that aliases won’t be kept after reboots, but you can add them in your .bashrc file. Open the file and add the above line somewhere in the file, preferably at the end or in a middle section with a comment telling that it’s a custom-alias area.

nano ~/.bashrc