Skip to content

Instantly share code, notes, and snippets.

@yetimdasturchi
Created January 22, 2024 06:54
Show Gist options
  • Save yetimdasturchi/eb4742e19e0b4207ddd333b9aca56f4b to your computer and use it in GitHub Desktop.
Save yetimdasturchi/eb4742e19e0b4207ddd333b9aca56f4b to your computer and use it in GitHub Desktop.
Ssh kalitlarni serverlar massiviga ko'chirish
#!/bin/bash
username="root" #ssh uchun foydalanuvchi
ssh_key_path="/home/$USER/.ssh/id_rsa.pub" #ssh kalit
# serverlar ro'yxati
servers=(
server1.domain.uz
server2.domain.uz
server3.domain.uz
)
for server in "${servers[@]}"
do
echo "SSH kalitni $server serveriga ko'chirish..."
ssh-copy-id -i $ssh_key_path $username@$server
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment