Created
January 3, 2018 18:50
-
-
Save farrellit/8292cc549cedbce0cb2413cec7d25720 to your computer and use it in GitHub Desktop.
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
ip=... | |
#pubkey=... # default should suffice if you have the default key location | |
ssh $ip "bash -c 'mkdir -p ~/.ssh; chmod 0700 ~/.ssh; cat > ~/.ssh/authorized_keys'" < ${pubkey:-~/.ssh/id_rsa.pub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this overwrites ~/.ssh/authorized_keys with the specified ssh pubkey. It's not idempotent and it's destructive to all other keys in the file.