Permalink
Browse files

adding script to create and place SSH keys (setupSSHKeys)

  • Loading branch information...
1 parent 312be1a commit a5d0d23bf0ccbf182c579de36955c3dc447b69ac @spf13 committed Jun 8, 2010
Showing with 14 additions and 0 deletions.
  1. +14 −0 setupSSHKeys.conf
View
@@ -0,0 +1,14 @@
+function setupSSHKeys() {
+ if [ -f $HOME/.ssh/id_rsa.pub ]; then
+ echo "PublicKey found!"
+ else
+ echo "PublicKey not found! Generating KeyPair"
+ ssh-keygen -t rsa
+ fi
+
+ if [ $# -eq 1 ] ; then
+ cat ~/.ssh/id_rsa.pub | ssh $1 'cat >> .ssh/authorized_keys; chmod 644 $HOME/.ssh/authorized_keys; ln -s $HOME/.ssh/authorized_keys $HOME/.ssh/authorized_keys2; chmod 700 $HOME/.ssh; chmod 644 $HOME/.ssh/id_rsa.pub; chmod 600 $HOME/.ssh/id_rsa'
+ else
+ echo "'$1' is not a server please use the form '[username]@[server]'"
+ fi
+}

0 comments on commit a5d0d23

Please sign in to comment.