1

I'm trying to make an automatic unlock of other partitions, I have 9 Logical volumes including root, and I know root LVM will unlock manually true password to have a key decrypted.

My goal is unlock with a usbkey. I followed some tutorials but no one did it, so I'm here asking your help, I think the scripts aren't right or I'm doing something wrong or they are out of date.

My system is Debian 8.3 with 9 LVM's all of them LUKS encrypted.

I tried with those tutorials:

0

I tried to unlock with this script and a key on a usbpen but i can't open having errors about key not find in boot, someone help?

Script:

#!/bin/sh

ask_for_password () {
    cryptkey="Unlocking the disk $cryptsource ($crypttarget)\nEnter passphrase: "
    if [ -x /bin/plymouth ] && plymouth --ping; then
        cryptkeyscript="plymouth ask-for-password --prompt"
        cryptkey=$(printf "$cryptkey")
    else
        cryptkeyscript="/lib/cryptsetup/askpass"
    fi
    $cryptkeyscript "$cryptkey"
}

device=$(echo $1 | cut -d: -f1)
filepath=$(echo $1 | cut -d: -f2)

# Ask for password if device doesn't exist
if [ ! -b $device ]; then
    ask_for_password
    exit
fi

mkdir /tmp/auto_unlocker
mount $device /tmp/auto_unlocker

# Again ask for password if device exist but file doesn't exist
if [ ! -e /tmp/auto_unlocker$filepath ]; then
    ask_for_password
else
    cat /tmp/auto_unlocker$filepath
fi

umount /tmp/auto_unlocker

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.