From bf16cccee67d078c40b1f2c86973d8fd4ed66bde Mon Sep 17 00:00:00 2001 From: "[ virtual snow ]" <59495119+virtualsnow@users.noreply.github.com> Date: Fri, 24 Jan 2020 00:54:47 -0800 Subject: [PATCH] file luks tricks --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index 2f3391b..08b2cbf 100644 --- a/README.md +++ b/README.md @@ -322,6 +322,34 @@ If the container is not running: $ docker run -it --user root --entrypoint /bin/bash ``` +**26. Linux transportable encrypted filesystems.** + +Like truecrypt but better. You may need to `losetup -f` to get a loop device. + +Make a junk file, here 256MB is used, encrypt, and partition. You will be prompted for a password. + +``` +$ dd if=/dev/urandom of=/tmp/crypted bs=1M count=256 iflag=fullblock +$ cryptsetup luksFormat /tmp/crypted +$ mkfs.ext3 /tmp/crypted +``` + +Mount: + +``` +# losetup /dev/loop0 /tmp/crypted +# cryptsetup open /dev/loop0 crypted +# mount -t ext3 /dev/mapper/crypted /mnt/crypted +``` + +Store data in `/mnt/crypted`, then unmount: + +``` +# umount /mnt/crypted +# cryptsetup close crypted +# losetup -d /dev/loop0 +``` + --------------------------------------------------------------------------