Created
July 21, 2014 17:02
-
-
Save paulrobinson/9b22dd0a2a587c18d5db to your computer and use it in GitHub Desktop.
ssh-key-send
This file contains hidden or 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/bash | |
| USER=$1 | |
| HOST=$2 | |
| if [ "$HOST" == "" ]; then | |
| echo "usage: $0 <user name> <host name>" | |
| exit 0 | |
| fi | |
| cat ~/.ssh/id_rsa.pub | ssh $USER@$HOST "cat - >> ~/.ssh/authorized_keys" || exit 1 | |
| echo -e "\nHost $HOST" >> ~/.ssh/config | |
| echo -e "\tUser $USER" >> ~/.ssh/config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment