Skip to content

Instantly share code, notes, and snippets.

@rizo
Created December 9, 2013 10:27
Show Gist options
  • Save rizo/7870188 to your computer and use it in GitHub Desktop.
Save rizo/7870188 to your computer and use it in GitHub Desktop.
#!/bin/bash
ssh $1@$2 mkdir -p .ssh
cat /Users/luiscorreia/.ssh/id_rsa.pub | ssh $1@$2 'cat >> .ssh/authorized_keys'
printf "Host %s\n" "$3" >> /Users/luiscorreia/.ssh/config
printf "\tHostName %s\n" "$2" >> /Users/luiscorreia/.ssh/config
printf "\tUser %s\n" "$1" >> /Users/luiscorreia/.ssh/config
printf "\n" >> /Users/luiscorreia/.ssh/config
@rizo
Copy link
Author

rizo commented Dec 9, 2013

Usage: ssh_add user host alias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment