„setup-servers“ ändern

This commit is contained in:
Yann Mölle 2023-04-19 20:25:44 +02:00
parent eed913af1f
commit 39b8aaf175

View File

@ -15,8 +15,8 @@ ssh_key_file="/root/.ssh/id_rsa.pub"
for server in "${servers[@]}"
do
echo "Adding SSH key to $server"
ssh -o StrictHostKeyChecking=no $server "sudo mkdir -p /root/.ssh && sudo chmod 700 /root/.ssh"
cat $ssh_key_file | ssh -o StrictHostKeyChecking=no $server "sudo tee -a /root/.ssh/authorized_keys > /dev/null"
ssh -o StrictHostKeyChecking=no $server "mkdir -p /root/.ssh && chmod 700 /root/.ssh"
cat $ssh_key_file | ssh -o StrictHostKeyChecking=no $server "tee -a /root/.ssh/authorized_keys > /dev/null"
if [ $? -eq 0 ]; then
echo "SSH key added to $server"
else