Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 31 lines (23 sloc) 768 Bytes
set -e
if [ $# -eq 0 ]; then
echo "Please specify the device path (e.g. /dev/sdb)"
exit 1
if [ ! -b $1 ]; then
echo "$1 is not a valid target device"
exit 1
# Note: if you prefer not to use the systemd ask-password utility, remove the
# following line and uncomment the one below it.
PW=$(systemd-ask-password "Enter your password:")
#echo "Enter your password" && read -s PW
CHALLENGE=$(printf $PW | sha256sum | awk '{print $1}')
echo "Touch your YubiKey"
RESPONSE=$(ykchalresp -2 $CHALLENGE)
echo "Decrypting and mounting device"
sudo cryptsetup open --type=luks $1 data <<<$KEY
mkdir -p $HOME/Data
sudo mount /dev/mapper/data $HOME/Data
echo "Opened $1 as /dev/mapper/data and mounted in $HOME/Data"