Skip to content

Instantly share code, notes, and snippets.

@paulrobinson
Created July 21, 2014 17:02
Show Gist options
  • Select an option

  • Save paulrobinson/9b22dd0a2a587c18d5db to your computer and use it in GitHub Desktop.

Select an option

Save paulrobinson/9b22dd0a2a587c18d5db to your computer and use it in GitHub Desktop.
ssh-key-send
#!/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