1

So I have an external LUKS-encrypted disk connected to my machine, and I want to automatically mount it after I log in. After some Googling I found pam_mount, and it does exactly what I want, except that it automatically unmounts at logout.

So how do I keep it from unmounting itself? I don't want to add a keyfile and I don't want to have it mounted at boot, only after logging in. I guess I could add something to .bashrc but that'd be my last resort.

1 Answer 1

1

Use keys to unlock the LUKS volume at boot up. Say your LUKS volume is on /dev/xvdb1, first create /etc/crypttab with the following content

cblk01  /dev/xvdb1 /etc/luks-key01 luks

Create a key and add it to your LUKS volume

openssl genrsa -out /etc/luks-key01 2048
chmod 400 /etc/luks-key01
cryptsetup luksAddKey /dev/xvdb1 /etc/luks-key01

Finally add this to /etc/fstab

/dev/mapper/cblk01  /data   xfs defaults 0 0
1
  • I suppose you also need adding line to /etc/crypttab Apr 4 at 13:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .