Created
November 11, 2020 00:19
-
-
Save brianlechthaler/432daeb2b7cc594d9d85b8d76934d2b3 to your computer and use it in GitHub Desktop.
LuksAutoInitGpg.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "USAGE: ./gpgpw.sh <number of characters> <long key ID to encrypt password to> <output file>" | |
echo "EXAMPLE: ./gpgpw.sh 1024 DEADBEEF0000FFFF0000FFFF0000FFFF0000FFFF /mnt/encrypted_password.asc /dev/xvdg" | |
export password=$(pwgen -sy $1 1) | |
echo $password | cryptsetup luksFormat $4 - | |
export password=$(echo $password | gpg --encrypt -a -r $2) | |
echo $password | |
echo $password > $3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment