Posts Tagged ‘luks’

How to Encrypt Partition under Ubuntu 11.10

Friday, December 9th, 2011

Here is a quick how-to for password protecting and encrypting your partition using cryptsetup under Ubuntu/Kubuntu Oneiric Ocelot. It should work for older versions too but haven’t tested it.

cryptsetup luksFormat /dev/sdaX
 
cryptsetup luksOpen /dev/sdaX cryptname
 
mkfs.ext4 /dev/mapper/cryptname
 
echo 'cryptname /dev/sdaX none luks' >> /etc/crypttab
 
mkdir /media/cryptname
 
echo '/dev/mapper/cryptname /media/cryptname ext4 defaults 0 2' >> /etc/fstab

Obviously you have to be root and have cryptsetup installed.
PS: I’m NOT responsible for any damage or data loss caused by executing the supplied code.