Created
June 3, 2018 00:25
-
-
Save mageddo/94ffce410f600d117aee79b4bc2f4c36 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| PUBLIC_KEY='tacape.mageddo.com.pub' | |
| for i in $(cat /tmp/servers.txt); do | |
| sudo cp "$HOME/.ssh/$PUBLIC_KEY" /tmp | |
| echo "Installing ssh key in server: $i" | |
| # rsync -ave ssh "~/.ssh/$PUBLIC_KEY" "root@$i:~/.ssh/" | |
| sudo scp "/tmp/$PUBLIC_KEY" "root@$i:~/.ssh/" | |
| echo "Trusting installed certificated" | |
| ssh "root@$i" "cat ~/.ssh/$PUBLIC_KEY >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/*" | |
| done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment