Skip to content

Instantly share code, notes, and snippets.

@g105b
Created January 27, 2017 15:09
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save g105b/0986281be735be00775c598581ddb2eb to your computer and use it in GitHub Desktop.
Save g105b/0986281be735be00775c598581ddb2eb to your computer and use it in GitHub Desktop.
Sync authorized_keys with Github public keys
#!/bin/bash
GITHUB_USERNAME=#PUT_YOUR_USERNAME_HERE
TMP=/tmp/existing_cron
crontab -l > $TMP
echo "*/10 * * * * /usr/bin/wget https://github.com/$GITHUB_USERNAME.keys -O ~/.ssh/authorized_keys" >> $TMP
crontab $TMP
rm $TMP
@g105b
Copy link
Author

g105b commented Jan 27, 2017

This is a really rough method of keeping your authorized_keys file in sync with the public keys on your Github account. Currently drops any existing keys in the file, so this is only useful if you use Github as your primary key storage area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment