cheat:cryptsetup
# To open an encrypted partition /dev/sdb1 (reachable at /dev/mapper/backup):
cryptsetup open --type luks /dev/sdb1 backup
# To open an encrypted partition /dev/sdb1 using a keyfile (reachable at /dev/mapper/hdd):
cryptsetup open --type luks --key-file hdd.key /dev/sdb1 hdd
# To close luks container at /dev/mapper/hdd:
cryptsetup close hdd
tldr:cryptsetup
# cryptsetup
# Manage plain dm-crypt and LUKS (Linux Unified Key Setup) encrypted volumes.
# More information: <https://gitlab.com/cryptsetup/cryptsetup/>.
# Initialize a LUKS volume (overwrites all data on the partition):
cryptsetup luksFormat /dev/sda1
# Open a LUKS volume and create a decrypted mapping at `/dev/mapper/{{target}}`:
cryptsetup luksOpen /dev/sda1 target
# Remove an existing mapping:
cryptsetup luksClose target
# Change the LUKS volume's passphrase:
cryptsetup luksChangeKey /dev/sda1
$
cheat.sh