linux:debian:disk-enryption
Differences
This shows you the differences between two versions of the page.
| linux:debian:disk-enryption [2020/12/11 12:39] – created oscar | linux:debian:disk-enryption [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Encrypt Partitions with LUKS/ | ||
| - | ===== Prerequisites ===== | ||
| - | Install cryptsetup with the following command: | ||
| - | sudo apt update | ||
| - | sudo apt upgrade | ||
| - | sudo apt install cryptsetup | ||
| - | Find the Block Device Name of Your Partition. Enter the following command: | ||
| - | < | ||
| - | lsblk | ||
| - | |||
| - | NAME | ||
| - | sda 8:0 0 232, | ||
| - | ├─sda1 | ||
| - | ├─sda2 | ||
| - | ├─sda3 | ||
| - | └─sda4 | ||
| - | sdb 8:16 0 698, | ||
| - | └─sdb1 | ||
| - | sr0 | ||
| - | </ | ||
| - | ===== Set Up LUKS Header ===== | ||
| - | Once you’re certain you have the right device name, add a LUKS header to the partition. | ||
| - | sudo cryptsetup luksFormat /dev/sdb1 | ||
| - | Type “YES” and then choose a strong password for your encrypted partition. Type the same password when asked to verify the passphrase. | ||
| - | ===== Create a Filesystem on the Partition ===== | ||
| - | You have to map this physical device to a virtual device. What gets written to the virtual device will be encrypted before being stored on the physical device. | ||
| - | sudo cryptsetup luksOpen /dev/sdb1 encrypted-partition | ||
| - | The partition needs a filesystem to be usable. Create an ext4 filesystem with this command: | ||
| - | sudo mkfs.ext4 / | ||
| - | ===== Mount Encrypted Partition ===== | ||
| - | Create the directory where you will mount the filesystem from the partition. | ||
| - | mkdir / | ||
| - | Mount the filesystem and change to that mounted directory: | ||
| - | sudo mount / | ||
| - | cd / | ||
| - | ===== Change ownership and rights ===== | ||
| - | At the moment, only the root user can write here. Give your user permission to write in this filesystem by making it the owner of the upper level directory. Copy and paste the whole command, including the “.” at the end. | ||
| - | sudo chown $USER:$USER . | ||
| - | Restrict other users from reading or writing to this directory. | ||
| - | chmod o= . | ||
| - | ===== Access from file manager ===== | ||
| - | At this point, most file managers should show you the new encrypted device in the interface. This shows how it looks in the Thunar file manager, the default used in the XFCE desktop environment. | ||
| - | |||
| - | If the volume is not mounted, when you click on it you will be asked for the volume password and your sudo password. The volume will be mounted automatically, | ||
| - | |||
| - | That is unimportant; | ||
| - | |||
| - | ===== Manual (un)mounting ===== | ||
| - | If, for some reason, your file manager doesn’t support this feature, you can mount from the terminal. | ||
| - | sudo cryptsetup luksOpen /dev/vda3 encrypted-partition | ||
| - | sudo mount / | ||
| - | You can now access the volume by going to “/ | ||
| - | cd && sudo umount / | ||
| - | sudo cryptsetup luksClose / | ||
linux/debian/disk-enryption.1607690361.txt.gz · Last modified: (external edit)
