2 # Do some of the steps necessary to SSH (key-based) with another server.
5 if [ "$#" -ne 1 ]; then
6 echo 'Need server IP as argument.'
11 # We need a public key to copy over, so generate it if not found.
12 if [ ! -f ~/.ssh/id_rsa.pub ]; then
16 # Add target to ~/.ssh/known_hosts so we don't get
17 # asked for permission at inopportune moments.
18 ssh-keyscan -H "$target" >> ~/.ssh/known_hosts
20 # Tell user what to do.
21 echo "APPEND FOLLOWING TO TARGET'S ~/.ssh/authorized_keys:"