Skip to content

Instantly share code, notes, and snippets.

@chaspy
Last active June 10, 2019 12:57
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 chaspy/e02a9be2a622f69022ed6c0d6f2512c7 to your computer and use it in GitHub Desktop.
Save chaspy/e02a9be2a622f69022ed6c0d6f2512c7 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eux
set -o pipefail
if [ "$(id -un)" != "root" ]; then
echo "You should run with sudo." 1>&2
echo "-------------------------"
exit 1
fi
user=$1
test -f /home/$user/.ssh/authorized_keys
curl -f https://github.com/${user}.keys | tee -a /home/$user/.ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment