2 ms·
This is a good step by step guide: https://loganmarchione.com/2015/05/encrypted-external-drive-with-luks/ https://loganmarchione.com/2015/05/encrypted-external
by theandrewbailey 6y ago
This is a good step by step guide:
https://loganmarchione.com/2015/05/encrypted-external-drive-with-luks/ https://loganmarchione.com/2015/05/encrypted-external-drive-...
As for decrypting (unlocking) and mounting the drive, most desktop environments have the capability. For my purposes, I use a script to unlock, backup, and lock when I attach an external HD to my server and SSH in:
#! /bin/bash
backupfrom="/srv/fileshares/"
echo "disk password first, then login password twice" # a reminder because I forget which one to put in
blockdev=${1:-/dev/sdd1}
device=$(udisksctl unlock -b $blockdev | grep -Po "(?<= as )/[0-9A-Za-z/-]+")
direct=$(udisksctl mount -b $device | grep -Po "(?<= at )/[0-9A-Za-z/-]+")
if [[ $? -eq 0 ]] ; then
rsync -atP --del $backupfrom $direct
fi
udisksctl unmount -b $device
udisksctl lock -b $blockdev
There's probably a better way to do this.