Created
May 28, 2012 19:21
-
-
Save kisom/2820784 to your computer and use it in GitHub Desktop.
copy ssh key to remote host
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
#!/bin/sh | |
if [ -z "$1" ]; then | |
echo "usage: $0 [user@]host [pubkey]" | |
exit 1; | |
fi | |
if [ -z "$2" ]; then | |
PUBKEY="$(cat ${HOME}/.ssh/id_rsa.pub)" | |
else | |
PUBKEY="$(cat $2)" | |
fi | |
ssh $1 echo "${PUBKEY} >> ~/.ssh/authorized_keys" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment