Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#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/
Copy link

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