Skip to content

Instantly share code, notes, and snippets.

@tphummel
Created July 15, 2016 18:33
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 tphummel/c4763d4a7b4b73a4428526ede98aae6f to your computer and use it in GitHub Desktop.
Save tphummel/c4763d4a7b4b73a4428526ede98aae6f to your computer and use it in GitHub Desktop.
add github user keys to authorized_keys via cloud-init/userdata
#!/usr/bin/env bash
set -o nounset
set -o errexit
set -o pipefail
IFS=$'\n\t'
main(){
users=( "tphummel" "githubuser2" "githubuser3" )
ssh_user="ssh_user"
for i in "${users[@]}"
do
curl "https://github.com/${i}.keys" >> "/home/${ssh_user}/.ssh/authorized_keys"
done
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment