Last active
November 18, 2016 02:24
-
-
Save hawkeyetwolf/073ffbd5bdc60018099c738b8ec9e880 to your computer and use it in GitHub Desktop.
Upload SSH public key to authorized_keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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