home · contact · privacy
Various fixes.
[config] / bookworm / 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 . ./misc.sh
5 . ../../misc.sh
6
7 expect_n_args 1 "(server IP)" "$@"
8 target="$1"
9
10 # We need a public key to copy over, so generate it if not found.
11 if [ ! -f ~/.ssh/id_rsa.pub ]; then
12     ssh-keygen -N ""
13 fi
14
15 # Add target to ~/.ssh/known_hosts so we don't get
16 # asked for permission at inopportune moments.
17 ssh-keyscan -H "$target" >> ~/.ssh/known_hosts
18
19 # Tell user what to do.
20 echo "APPEND FOLLOWING TO TARGET'S ~/.ssh/authorized_keys:"
21 cat ~/.ssh/id_rsa.pub