Last active
December 20, 2015 20:39
-
-
Save d1rtym0nk3y/6192227 to your computer and use it in GitHub Desktop.
copy your public key to the authorized_keys file on a remote machine
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
cat ~/.ssh/id_rsa.pub | ssh root@server "(cat > tmp.pubkey ; mkdir -p .ssh ; touch .ssh/authorized_keys ; sed -i.bak -e '/$(awk '{print $NF}' ~/.ssh/id_rsa.pub)/d' .ssh/authorized_keys; cat tmp.pubkey >> .ssh/authorized_keys; rm tmp.pubkey)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment