home · contact · privacy
Fix.
[config] / bullseye / setup_scripts / prepare_to_meet_server.sh
1 #!/bin/sh
2 # Do some of the steps necessary to SSH (key-based) with another server.
3 set -e
4
5 if [ "$#" -ne 1 ]; then
6     echo 'Need server IP as argument.'
7     false
8 fi
9 target="$1"
10
11 # We need a public key to copy over, so generate it if not found.
12 if [ ! -f ~/.ssh/id_rsa.pub ]; then
13     ssh-keygen -N ""
14 fi
15
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
19
20 # Tell user what to do.
21 echo "APPEND FOLLOWING TO TARGET'S ~/.ssh/authorized_keys:"
22 cat ~/.ssh/id_rsa.pub