627 shaares
# create encrypted file container
dd if=/dev/zero bs=1M count=1000 of=./container.img
sudo cryptsetup luksFormat ./container.img
sudo cryptsetup luksOpen ./container.img container
sudo mkfs.ext4 /dev/mapper/container
sudo mount /dev/mapper/container /mnt/
# open encrypted file container
sudo cryptsetup luksOpen ./container.img container
sudo mount /dev/mapper/container /mnt/
# close encrypted file container
sudo umount /mnt
sudo cryptsetup luksClose container