This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
computing:encryption [2024/01/29 18:01] – oemb1905 | computing:encryption [2025/03/09 18:11] (current) – oemb1905 | ||
---|---|---|---|
Line 7: | Line 7: | ||
------------------------------------------- | ------------------------------------------- | ||
- | Creating | + | To use pam_mount to mount a LUKS crypt and map it to your home partition. Note: make sure the crypt password matches |
+ | |||
+ | sudo apt-get install | ||
+ | rsync -av /home /backup | ||
+ | umount /home/ | ||
+ | cryptsetup luksFormat /dev/sdaX | ||
+ | cryptsetup luksOpen /dev/sdaX home | ||
+ | mkfs.xfs -L home / | ||
+ | mount / | ||
+ | rsync -av / | ||
+ | sudo nano / | ||
+ | <volume user=" | ||
+ | |||
+ | To use pam_mount to mount a LUKS crypt to a non-home directory partition, then adjust as follows: | ||
- | sudo apt-get install cryptsetup libpam-mount | ||
cryptsetup luksFormat /dev/sdaX | cryptsetup luksFormat /dev/sdaX | ||
cryptsetup luksOpen /dev/sdaX vault | cryptsetup luksOpen /dev/sdaX vault | ||
mkfs.xfs -L vault / | mkfs.xfs -L vault / | ||
+ | mkdir /mnt/vault | ||
+ | mount / | ||
+ | sudo nano / | ||
+ | <volume user=" | ||
| | ||
- | To manually | + | You may optionally |
| | ||
mkdir /mnt/vault | mkdir /mnt/vault | ||
mount / | mount / | ||
- | After you reboot, the crypt will no longer be open, so you will need to open it first before mounting | + | After you reboot, the crypt will no longer be open, but your mount point will still be there, so you just need to open the LUKS crypt and then map the LUKS partition to your mount point again as follows: |
cryptsetup luksOpen /dev/sdaX vault | cryptsetup luksOpen /dev/sdaX vault | ||
mount / | mount / | ||
- | Okay, so if mounting manually proves | + | Users might also to prefer to use crypttab and fstab to handle the mounting and mapping. To do so, let' |
- | sudo dd if=/ | + | sudo dd if=/ |
- | Add the keyfile to the crypt so that it can be used to open the crypt: | + | Add the keyfile to the LUKS crypt so that it can be used to open the crypt: |
- | sudo cryptsetup -v luksAddKey /dev/sdb1 /etc/lukskeys/vaultkey | + | sudo cryptsetup -v luksAddKey /dev/sdaX /path/to/ |
| | ||
- | Now, we need to get the partition' | + | After adding the key to the crypt, let' |
- | sudo cryptsetup luksDump /dev/sdb1 | grep " | + | sudo cryptsetup luksDump /dev/sdaX | grep " |
| | ||
- | Open crypttab up, and add the example below, adjusting as necessary. | + | Now that we have the UUID of the crypt, we can add a reliable crypttab entry for the crypt. |
| | ||
sudo nano / | sudo nano / | ||
- | <sdb1_crypt | + | <sdaX_crypt |
| | ||
- | Now that crypttab is setup, this means you you can open the crypt as follows: | + | Now that crypttab is setup, this means you you can open the crypt as follows. |
- | sudo cryptdisks_start | + | sudo cryptdisks_start |
| | ||
- | But, since this only opens it and does not mount it, you will need to add an entry to fstab similar to the one provided below: | + | If you want, however, the crypt to mount on its own, then add an entry to fstab as well. |
sudo nano /etc/fstab | sudo nano /etc/fstab | ||
- | </ | + | </ |
| | ||
- | Alternately, you may want to let pam_mount manage the crypt mounting | + | Okay, your LUKS crypt should now be open and mapped |
- | + | ||
- | rsync -av /home /backup | + | |
- | umount /home/ | + | |
- | cryptsetup luksFormat /dev/sdaX | + | |
- | cryptsetup luksOpen /dev/sdaX home | + | |
- | mkfs.xfs -L home / | + | |
- | | + | |
- | rsync -av / | + | |
- | sudo nano / | + | |
- | <volume user=" | + | |
- | + | ||
- | Remove the error " | + | |
sudo nano / | sudo nano / | ||
< | < | ||
- | + | --- // | |
- | --- // | + |