apt-get install cryptsetup
Let us assume that /dev/sda7 should become our encrypted /tmp partition. We will start and write a lot of random data into this partition. This will protect against some kind of cryptoanalysis attacks.
dd if=/dev/urandom of=/dev/sda7
Depending on the size of your /tmp partition you should go and drink one or more coffees. This step will take some time.
Next we setup the cryptography device using cryptsetup:
cryptsetup --key-file /dev/urandom --key-size 128 create ctmp /dev/hda7
Finnaly we modify
/etc/crypttab
and /etc/fstab
:/etc/crypttab:
ctmp /dev/sda7 /dev/urandom tmp,chiper=aes-cbc-essiv:sha256,size=128,hash=ripemd160
/etc/fstab:
/dev/mapper/ctmp none ext2 nodev,nosuid 0 2
Now restart your computer and your /tmp partition should be encrypted.