I want to access a LUKS encrypted data partition after login, ideally without typing a password, obviously in a secure way.
My home directory is also encrypted with LUKS.
I found this tutorial: https://ubuntuforums.org/showthread.php?t=837416.
It feels completely un-safe to me as anyone booting a live cd can access the
root directory, thus the key, thus de-crypt the data of the other partition.
Here is what I have done so far,
Create a new key:
sudo dd if=/dev/urandom of=$HOME/.data_crypt_keyfile bs=1024 count=4
Make it read-only to root:
sudo chmod 0400 $HOME/.data_crypt_keyfile
Add this new key to the LUKS key slots:
sudo cryptsetup luksAddKey /dev/sdc1 $HOME/.data_crypt_keyfile
How do I automatically open this partition after login, and close it when logging-out?