Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
@farrellit
Copy link
Author

farrellit commented Jan 3, 2018

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.

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