Sunday, March 8, 2009

Truecrypt on Debian

I have an encrypted file on Windows XP. The file is formatted ntfs and resides on a disk partition formatted with ntfs. I installed Debian Lenny (version 5.0 of Debian) on a separate hard drive, with the default Desktop GUI options.

I'm assuming other people want to use Truecrypt on Debian. It's not part of the normal Debian repositories because of the software license. Here's what I had to do to my default install of Debian Lenny:
The following apt-get commands are run as the root (superuser):
apt-get install dmsetup
apt-get install libwxgtk2.8-dev
apt-get install libwxbase2.8-dev
apt-get install libfuse-dev
apt-get install libopencryptoki-dev
apt-get install g++
apt-get install make gcc gcc-multilib manpages-dev gdb
apt-get install wx2.8-headers
apt-get install libopencryptoki0
apt-get install fuse-utils
apt-get install libfuse2 ntfs-3g
apt-get install libwxgtk2.8-0
(OR, you can run it all as one line:
apt-get install dmsetup libwxgtk2.8-dev libwxbase2.8-dev libfuse-dev libopencryptoki-dev libopencryptoki-dev g++ make gcc gcc-multilib manpages-dev gdb wx2.8-headers libopencryptoki0 fuse-utils libfuse2 ntfs-3g libwxgtk2.8-0
OR, you can install all of the programs through the synaptic software package management GUI. I'm no command line expert, but I find it simpler to just type the commands above when I know what I want.
)

I am 95% certain one or more of the items above is unnecessary, but it won't hurt to install all of them. I did not feel like going back and uninstalling different ones and trying to compile the application again. I know that if you have all of the above, compiling Truecrypt works.

The following you can (should) do as your normal user. For the sake of instructions, I'm assuming your account name is 'plankton' and your home directory is '/home/plankton'. Substitute your actual home directory and account name for 'plankton'.
1. Download the Linux source code to Truecrypt from the official website to /home/plankton, and open a shell at that directory. Run
gunzip truecrypt-6.1a-source.tar.gz
tar -xvvf truecrypt-6.1a-source.tar
You can combine both steps to one line, but I don't remember how and don't care to look it up at the moment.
When you are finished, my instructions assume everything is in a directory
/home/plankton/truecrypt-6.1a-source
2. Go to ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20 (you can paste that address into your web browser) and download all of the files with a '.h' extension at that location. Put them into a directory named 'pkcs' and paste the 'pkcs' directory into /home/plankton/truecrypt-6.1a-source/ directory
3. In your shell, cd to the /home/plankton/truecrypt-6.1a-source directory and type:
export PKCS11_INC=/home/plankton/Desktop/truecrypt-6.1a-source/pkcs/
4. Type 'make' and hit enter. Truecrypt will be compiled for you.

When you are finished, the directory
/home/plankton/truecrypt-6.1a-source/Main will contain an executable file named 'truecrypt'. Copy the truecrypt executable to /home/plankton/truecrypt

To run truecrypt as a normal user:
I'm still having problems getting it to run as a GUI.
As root, I used the 'visudo' command to add the following line to the sudoers file
plankton ALL = /home/plankton/truecrypt
This is the command line I use to mount my Truecrypt file from my third partition on my second hard drive:
sudo /home/plankton/truecrypt --filesystem=ntfs-3g --mount /media/sdb3/EncryptedDrive_OnD.tc --fs-options=umask=000,uid=1000,guid=1000

(The uid and guid of the plankton account are both 1000.)
Enter passwords when prompted.

Good luck!

2 comments:

  1. Awesome! I have been trying to find a way to install TrueCrypt via command-line for quite some time now, as that's my only interface with my machine. Took a bit of time to get everything working but your instructions were great!

    In step 3, you say "... /home/plankton/Desktop/..." when in all other steps you don't have that "Desktop" bit in there. I omitted that part and it all went well. Thank you so much for posting this!

    ReplyDelete
  2. followd your owto got this at the end but it was the most recent source 6.3a

    ok i cannot pate hereso here is the link in pastebin


    http://pastebin.org/57719

    ReplyDelete