From b6019fed9f69630ea5708f0c919909f178a867be Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 15 Dec 2018 12:04:11 +0100 Subject: [PATCH] Script to ease setting up SSH connections. --- all_new_2018/prepare_to_meet_server.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 all_new_2018/prepare_to_meet_server.sh diff --git a/all_new_2018/prepare_to_meet_server.sh b/all_new_2018/prepare_to_meet_server.sh new file mode 100644 index 0000000..1e73ae0 --- /dev/null +++ b/all_new_2018/prepare_to_meet_server.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# Do some of the steps necessary to SSH (key-based) with another server. +set -e + +target="$1" + +# We need a public key to copy over, so generate it if not found. +if [ ! -f ~/.ssh/id_rsa.pub ]; then + ssh-keygen +fi + +# Add target to ~/.ssh/known_hosts so we don't get +# asked for permission at inopportune moments. +ssh-keyscan -H "$target" + +# Tell user what to do. +echo "APPEND FOLLOWING TO TARGET'S ~/.ssh/authorized_keys:" +cat ~/.ssh/id_rsa.pub -- 2.30.2