(1) create a random keyfile
Code:
sudo dd if=/dev/urandom of=/root/keyfile bs=1024 count=4
(2) chmod keyfile to root-read only
Code:
sudo chmod 0400 /root/keyfile
(3) add the key as new possible authorization
Code:
sudo cryptsetup luksAddKey /dev/sdX /root/keyfile
You should first be prompted to authorize yourself with an existing keyfile or password and the should get an output like that:
(4) Open /etc/crypttab
Code:
sudo nano /etc/crypttab
and add the new harddisk there (you may already have it added, if so then just alter the existing one)
Code:
sdX_crypt /dev/sdX /root/keyfile luks
(5) Open /etc/fstab
Code:
sudo nano /etc/fstab
and add the new harddisk there (you may already have it added, if so then just alter the existing one)
Code:
/dev/mapper/sdX_crypt /media/sdX ext3 defaults 0 2
That would mount it at /media/sdX
That's it, the second harddisk will get unlocked automatically upon booting normally.
Bookmarks