Skip to content

Instantly share code, notes, and snippets.

@craftyguy
Created December 4, 2017 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craftyguy/64a9b67669faddecda591cb12094c49f to your computer and use it in GitHub Desktop.
Save craftyguy/64a9b67669faddecda591cb12094c49f to your computer and use it in GitHub Desktop.
Verify signature and import authorized_keys file
#!/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