Published in feeding.cloud.geek.nz - 24-05-2008
Laptops are easily lost or stolen and in order to protect your emails, web passwords, encryption keys, etc., you should really think about encrypting (at least) your home directory.
If you happen to have /home on a separate partition already (/dev/hda5 in this example), then it's a really easy process:
- Copy your home directory to a temporary directory on a different partition:
mkdir /homebackup
cp -a /home/* /homebackup
- Encrypt your home partition:
umount /home
cryptsetup -h sha256 -c aes-cbc-essiv:sha256 -s 256 luksFormat /dev/hda5
cryptsetup luksOpen /dev/hda5 chome
mkfs.ext3 -m 0 /dev/mapper/chome
- Add this line to /etc/crypttab:
chome /dev/hda5 none luks,timeout=30
- Set the home partition to this in /etc/fstab:
/dev/mapper/chome /home ext3 nodev,nosuid,relatime 0 2
- Copy your home data back into the encrypted partition:
mount /home
cp -a /homebackup/* /home
rm -rf /homebackup
That's it. Now to fully secure your laptop against theft, you should think about an encrypted backup strategy for your data...