Monday, January 9, 2012
Encrypted /home with cryptsetup easy and fast
1: partition;
modprobe dm-crypt aes-x86_64
cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/sda4
# Also remember that in order for other accounts to still be able to unlock this partition, you need to add all Linux account passwords as keys to unlock the partition.
cryptsetup luksAddKey /dev/sda4
cryptsetup luksOpen /dev/sda4 home
ls /dev/mapper/home
mkfs.ext4 -O dir_index /dev/mapper/home
<volume fstype="crypt" path="/dev/sda4" mountpoint="/home" />
2: file
losetup -f /path/file
cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/loop0
# Also remember that in order for other accounts to still be able to unlock this partition, you need to add all Linux account passwords as keys to unlock the partition.
cryptsetup luksAddKey /dev/loop0
cryptsetup luksOpen /dev/loop0 home
ls /dev/mapper/home
mkfs.ext4 -O dir_index /dev/mapper/home
<volume fstype="crypt" path="/dev/sda4" mountpoint="/home" options="loop"/>