3 #this script is copied from https://github.com/guioconnor/Passwordless-SSH.
4 #the Bottlenecks project needs to set the machines login each other passwordless, this script is appropriate.
19 # Read the host and username to store public key (the host/username accepting passwordless ssh from this computer)
20 echo "What host you want to grant passwordless SSH from this computer?"
22 echo "What is your username on $hostname? ($USER?)"
33 if [ -f $path/$filename ]
35 echo "RSA key exists on $path/$filename, using existing file"
37 ssh-keygen -t rsa -f "$path/$filename"
38 echo RSA key pair generated
41 echo "We need to log into $hostname as $username to set up your public key (hopefully last time you'll use password from this computer)"
42 cat "$path/$filename.pub" | ssh "$hostname" -l "$username" '[ -d .ssh ] || mkdir .ssh; cat >> .ssh/authorized_keys; chmod 700 ~/.ssh; chmod 600 ~/.ssh/authorized_keys'
47 echo "Set up complete, try to ssh to $host now"
50 echo "an error has occured"