Skip to content

Instantly share code, notes, and snippets.

@vinioliveira
Created June 22, 2011 11:57
Show Gist options
  • Save vinioliveira/1039942 to your computer and use it in GitHub Desktop.
Save vinioliveira/1039942 to your computer and use it in GitHub Desktop.
SSH_KEY GENERATE
user@<yourdomain.com> [~]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_dsa): # Press 'enter' here
Enter passphrase (empty for no passphrase): # Press 'enter' here
Enter same passphrase again: # Press 'enter' here
Your identification has been saved in /home/user/.ssh/id_dsa.
Your public key has been saved in /home/user/.ssh/id_dsa.pub.
The key fingerprint is:
6f:c3:cb:50:e6:e9:90:f0:0f:68:d2:10:56:eb:1d:91
user@<yourdomain.com> [~]# ssh-copy-id -i ~/.ssh/id_dsa.pub user@'74.63.***'
#!/bin/sh
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 user@host.tld 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