From 0eb7f4ca04b26bd876cd6130becd9d2030f5de36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20M=C3=B6lle?= Date: Wed, 19 Apr 2023 19:52:05 +0200 Subject: [PATCH] =?UTF-8?q?=E2=80=9Eauthorize-server=E2=80=9C=20l=C3=B6sch?= =?UTF-8?q?en?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- authorize-server | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 authorize-server diff --git a/authorize-server b/authorize-server deleted file mode 100644 index c64ef1e..0000000 --- a/authorize-server +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# Read the server list from the specified file -SERVER_LIST_FILE="servers.conf" - -while IFS= read -r SERVER || [ -n "$SERVER" ]; do - SERVER_LIST+=("$SERVER") -done < "$SERVER_LIST_FILE" - -# Read the public SSH key from the update server -UPDATE_SERVER="10.0.3.77" # replace with your update server IP address -PUBLIC_KEY=$(ssh root@${UPDATE_SERVER} "cat ~/.ssh/id_rsa.pub") - -# Loop through the server list and add the public key to the authorized_keys file of each server -for SERVER in "${SERVER_LIST[@]}" -do - # Establish SSH connection to remote server and add the public key to the authorized_keys file - ssh root@${SERVER} "mkdir -p ~/.ssh && echo '${PUBLIC_KEY}' >> ~/.ssh/authorized_keys" - echo "Public key added to authorized_keys on server ${SERVER}" -done \ No newline at end of file