From 0423a4ba730cfb268ce314a6d7b5a3b8596997d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20M=C3=B6lle?= Date: Wed, 19 Apr 2023 19:44:50 +0200 Subject: [PATCH] =?UTF-8?q?=E2=80=9Eauthorize-server=E2=80=9C=20=C3=A4nder?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- authorize-server | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/authorize-server b/authorize-server index 93d7e9b..b1ab381 100644 --- a/authorize-server +++ b/authorize-server @@ -9,12 +9,12 @@ done < "$SERVER_LIST_FILE" # Read the public SSH key from the update server UPDATE_SERVER="192.168.1.100" # replace with your update server IP address -PUBLIC_KEY=$(ssh username@${UPDATE_SERVER} "cat ~/.ssh/id_rsa.pub") +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 username@${SERVER} "mkdir -p ~/.ssh && echo '${PUBLIC_KEY}' >> ~/.ssh/authorized_keys" + 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