Tools 101: cryptsetup

Create a LUKS (Linux Unified Key Setup) formated, encrypted device:

cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb1

Display encrypted device info:

cryptsetup luksDump /dev/sdb1

Open (unlock) encrypted device

cryptsetup open --type luks /dev/sdb1 crypt

Close (lock) encrypted device

cryptsetup close --type luks crypt

Add pass-phrase from key_file, total of eight are allowed

cryptsetup luksAddKey /dev/sdb1 /home/xyz/key_file

Remove pass-phrase previously added from key_file, undo the above AddKey step

cryptsetup luksRemoveKey /dev/sdb1 /home/xyz/key_file

Open encrypted drive using key file

cryptsetup open --type luks --key-file /home/xyz/key_file /dev/sdb1 crypt

Leave a comment

Your email address will not be published. Required fields are marked *