Skip to content

Instantly share code, notes, and snippets.

@lemajes
Last active May 1, 2023 13:11
Show Gist options
  • Save lemajes/64c1b2158b79ebec70a7209cfc3580b2 to your computer and use it in GitHub Desktop.
Save lemajes/64c1b2158b79ebec70a7209cfc3580b2 to your computer and use it in GitHub Desktop.
[ENCRYPTED PORTABLE VAULT 101] Encrypted portable vault 101 #encrypted #portable #vault #file #linux #cryptsetup #luks

ENCRYPTED PORTABLE VAULT 101

  • Create empty file dd if=/dev/urandom of=vaultfile.img bs=1M count=512

  • Create LUKS volume cryptsetup --verify-passphrase luksFormat vaultfile.img

  • Open LUKS volume

sudo cryptsetup open --type luks vaultfile.img myvault
ls /dev/mapper
  • Create filesystem sudo mkfs.ext4 -L myvault /dev/mapper/myvault

  • Close if needed sudo cryptsetup close myvault

  • Start using

sudo cryptsetup open --type luks vaultfile.img myvault
ls /dev/mapper
sudo mkdir /myvault
sudo mount /dev/mapper/myvault /myvault
  • Stop using
sudo umount /myvault
sudo cryptsetup close myvault
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment