Linux implements the encrypted file system. luks is the encryption standard for Linux hard disks. Mainly used: luksFormat, luksOpen, luksClose, luksAddKey and other parameters and manual creation of/etc/crypttab first we create a disk partition/dev/sdb5 without formatting households 1. Encrypted partitioning # cryptsetupluksFormat/dev/sdb5AreyousureTyp
Linux implements the encrypted file system. luks is the encryption standard for Linux hard disks.
You can use luksFormat, luksOpen, luksClose, luksAddKey, and other parameters to manually create/etc/crypttab.
First, create a disk partition/dev/sdb5 without formatting.
1. Encrypted partitioning
# Cryptsetup luksFormat/dev/sdb5
Are you sure Type Uppercase yes: YES
Enter luks passphrase: 123
Verify passphase: 123
2. decrypt the partition
Cryptsetup luksOpen/dev/sdb5 secret (mapped to secret)
Enter passphrase for/dev/sdb5:
3. Create a mount point
# Mkdir/mnt/test/secret
4. Format
Mke2fs-t ext4/dev/mappper/secret
5. hanging in a partition
# Mount/dev/mapper/mnt/testsecret
6. Detach a partition
# Umount/dev/mapper/secret
# Cryptsetup luksClose secret
7. Automatic Configuration mounting
Add the following lines to. etc/fstab:
/Dev/mapper/secret/mnt/testsecret ext4 defaults 0 0
Create a/etc/crypttab File
Add
Secret/dev/sdb5/root/testpasswd
Create Password File
Echo "123">/root/testpasswd
Chmod 600/root/testpasswd
Add a key file
# Cryptsetup luksAddKey/dev/sdb5/root/testpasswd
The host is successfully restarted.