Friday, October 06, 2006

TrueCrypt shortcuts that saves time and keeps files safe

TruecryptTrueCrypt is brilliant. It creates a virtual drive where everything stored in the drive is protected by encryption. Given the sensitive nature of Men's Clinic data on my laptop, I can now ensure that this data is completely meaningless to anyone who steals my laptop.
I can also keep a backup on site at the client's premises where no-one except those who know the passphrase can open it. To get access to the drive quickly, I have a shortcut on my desktop that runs a batch file. The batch file contains the following:
@echo off
if not exist x:\nul goto TCMount
start x:\dev\clinic
goto END
echo Please enter TrueCrypt password
"C:\Program Files\TrueCrypt\TrueCrypt.exe" _
/l X /v D:\DonnDev.pgd /q
start x:\dev\clinic

What does it do? It checks to see if drive X: exists, and if so, opens the directory. if not, it uses TrueCrypt to mount the directory (after asking for the passphrase) and then opens the directory. Either way, by the time it has finished the directory is open and I can begin work. Simple, yet so effective.
Note: the underscore indicates that the line continues, i.e. the line beginning "C:\ .." ends with "... /q". If you add "/c y /m ts" at the end, TrueCrypt will remember your password until you reboot, and time stamp the volume file each time you open it, so that backups work correctly.


caseodilla said...

what does the line "/l X /v D:\DonnDev.pgd /q" do? i follow your programming up until that point.

i've used your code as a basis for a shortcut batch of my own, but i cannot figure out how to make the batch finish executing in command prompt before i manually exit out of truecrypt.

heres my code (i commented out the last two lines as i've found they do nothing necessary for my setup),

@echo off
if not exist i:\nul goto TCMount
start i:\
goto END
echo Enter TrueCrypt password...
"C:\Program Files\TrueCrypt\TrueCrypt.exe" C:\importants
::if exist i:\
::start i:\

any suggestion?

Donn Edwards said...

The "c:\importants" parameter doesn't tell truecrypt anything.

a) You need to create a standard TrueCrypt volume. Give it a name like c:\Importants.pgd

b) You have to decide what drive letter to map it to, such as X:

c) Then use the following line: (it's all one line, not two)
"C:\Program Files\TrueCrypt\TrueCrypt.exe"
/l X /v c:\Importants.pgd /q

That will tell Truecrypt to Load (/l X) the file as drive X, to use the volume (/v c:\Importants.pgd) that you created, and to quit (/q) when done.

If you include "/c y /m ts" at the end of the line, it will cache your passphrase and keep the time stamp of your TrueCrypt file current, which is useful for making backups.