4 echo This script will help you setup ssh public key authentication.
10 while [ -n "$host" ]; do
11 echo -n "SSH server: "
13 if [ -n "$host" ]; then
14 echo -n "user[$USER]: "
16 if [ -z "$usr" ]; then
20 echo "Setting up RSA authentication for ${usr}@${host}..."
21 if [ -f ~/.ssh/id_rsa.pub ]; then
22 echo "RSA public key OK."
24 ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ""
26 scp ~/.ssh/id_rsa.pub ${usr}@${host}:~/
27 ssh ${usr}@${host} "if [ ! -d ~/.ssh ]; then
30 cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
31 chmod 0600 ~/.ssh/authorized_keys
34 echo "You should see the following message without being prompted for anything now..."
36 ssh ${usr}@${host} "echo !!! Congratulations, you are now logged in as ${usr}@${host} !!!"
38 echo "If you were prompted, public key authentication could not be configured..."
41 echo "Enter a blank servername when done."
46 echo "End of configuration."