How to setup the use of a USB pen drive as a key for an ecryptfs private directory
|
Partition and format the USB stick
If it's not already done, you'll want to partition and format a filesystem to be used to hold the key data from ecryptfs:
# fdisk /dev/sdb # mkfs.ext3 /dev/sdb1
Copy your .ecryptfs to the USB stick
Mount the pen drive on a temporary path, then copy .ecryptfs from your home directory to the temporary mountpoint.
# mount /dev/sdb1 /mnt # cp -a /home/USERNAME/.ecryptfs/* /mnt # umount /mnt
Obtain the device's UUID
This step is required for automatizing the mounting of the pen drive to the proper path on boot.
# blkid /dev/sdb1
Automatize
To mount on boot
Add the following line to /etc/fstab to mount the USB pen drive to the proper directory on boot:
UUID=<UUID from blkid> /home/<username>/.ecryptfs ext3 relatime 0 2
To mount on connection
There has to be a way to do this...