#!/bin/bash if [ "$(id -u)" -ne 0 ]; then echo "Must be root" exit 1 fi set -eu if [ -f /root/.ssh/id_rsa.pub ]; then echo "SSH public key already exists. Exiting!" exit 1 fi if [ -f /root/.ssh/config ]; then echo "SSH config already exists. Exiting!" exit 1 fi umask 0077 echo ">>> ssh-keygen" ssh-keygen cat /root/.ssh/id_rsa.pub echo ">>> creating .ssh/config" cat > /root/.ssh/config <