Difference between revisions of "LUKS"

From David's Wiki
Jump to navigation Jump to search
Line 25: Line 25:
 
===Mounting===
 
===Mounting===
 
<pre>
 
<pre>
# Decrypt the drive
+
# Open the encrypted drive
 
cryptsetup open <device> <name>
 
cryptsetup open <device> <name>
 
# Mount your partition
 
# Mount your partition

Revision as of 22:56, 25 July 2020

LUKS encryption

Getting Started

See Archwiki: dm-crypt/Device encryption.

Encrypting a device

  • Setup encryption
cryptsetup -v --type luks --cipher aes-xts-plain64 --key-size 512 --hash sha512 \
           --iter-time 3000 --use-urandom --verify-passphrase luksFormat <device>
  • Open encrypted drive
cryptsetup open <device> <name>
  • Create a partition
mkfs.fstype /dev/mapper/<name>
# E.g.
# mkfs.ext4 /dev/mapper/luksdrive1

Mounting

# Open the encrypted drive
cryptsetup open <device> <name>
# Mount your partition
mount -t <fstype> /dev/mapper/<name> <mountlocation>

Unmounting

# Unmount your partition
umount <mountlocation>
# Close the decrypted drive
cryptsetup close <name>

Resources