This is one possibility to do this. There are other and maybe even better ways to do this.
-
Generate a key for your encrypted harddisk:
dd if=/dev/random of=/home/bob/keyfile_sdb1 bs=4096 count=1
-
Then add your keyfile to encrypted harddisk: How to change your dm-crypt passphrase (step 3)
-
Create a mountpoint:
mkdir /mnt/space
-
Create a script e.g. in your homedirectory (/home/bob/mount_sdb1.sh):
#!bin/bash #open harddisk sudo /sbin/cryptsetup --key-file /home/bob/keyfile_sdb1 luksOpen /dev/sdb1 sdb1_crypt #mount decrypted harddisk sudo /bin/mount /dev/mapper/sdb1_crypt /mnt/space
-
Add this line to your /etc/sudoers that you must not enter a password
%admin ALL=(ALL) NOPASSWD:/sbin/cryptsetup, /bin/mount
-
Add this script to "System - Einstellungen - Startprogramme"
After rebooting the harddisk should be mounted automatically
Posted by Kim Klotz to makandra dev (2012-03-21 12:28)