Skip to content

Instantly share code, notes, and snippets.

@hawkeyetwolf
Last active November 18, 2016 02:24
Show Gist options
  • Save hawkeyetwolf/073ffbd5bdc60018099c738b8ec9e880 to your computer and use it in GitHub Desktop.
Save hawkeyetwolf/073ffbd5bdc60018099c738b8ec9e880 to your computer and use it in GitHub Desktop.
Upload SSH public key to authorized_keys
# Thanks to Chris Hales for giving me this little snippet back in the day.
# Replace "__SERVER__" with "user@hostname".
cat ~/.ssh/id_rsa.pub | ssh __SERVER__ 'cat >> ~/.ssh/authorized_keys'
# Make sure permissions are correctly set on the file and its parent directory.
ssh __SERVER__ 'chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment