Created
December 4, 2017 18:31
-
-
Save craftyguy/64a9b67669faddecda591cb12094c49f to your computer and use it in GitHub Desktop.
Verify signature and import authorized_keys file
This file contains hidden or 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/bash | |
if [ -z "$1" ]; then | |
echo "Usage: import_auth_keys /path/to/authorized_keys.asc" | |
exit 1 | |
fi | |
gpg --verify "$1" | |
read -r -p "Import authorized_keys file? [y/N] " resp | |
case "$resp" in | |
[yY]) | |
mkdir -p ~/.ssh | |
chmod 600 ~/.ssh | |
gpg -o ~/.ssh/authorized_keys --decrypt "$1" | |
;; | |
*) | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment