Skip to content

Instantly share code, notes, and snippets.

@joaovitor
Created March 4, 2010 05:22
Show Gist options
  • Save joaovitor/321422 to your computer and use it in GitHub Desktop.
Save joaovitor/321422 to your computer and use it in GitHub Desktop.
#!/bin/sh
# http://blog.tinogomes.com/2010/02/24/ssh-copy-id-no-mac-os-x/
KEY="$HOME/.ssh/id_rsa.pub"
if [ ! -f $KEY ];then
echo "private key not found at $KEY"
echo "* please create it with "ssh-keygen -t dsa" *"
echo "* to login to the remote host without a password, don't give the key you create with ssh-keygen a password! *"
exit
fi
if [ -z $1 ];then
echo "Please specify [email protected] as the first switch to this script"
exit
fi
echo "Putting your key on $1... "
KEYCODE=`cat $KEY`
cat $KEY | ssh $1 "cat - >> ~/.ssh/authorized_keys"
echo "done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment