Created
February 3, 2017 23:13
-
-
Save thedoc31/8f0288957ce11441f7a3803f4e946c5b to your computer and use it in GitHub Desktop.
Batch copy SSH key to multiple servers from an input text file
This file contains 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
## serverlist should be FQDN or IP addresses, one server per line, no delimiters | |
## command will fail if serverlist.txt is not in UNIX format | |
while read name || [[ -n $name ]]; do sshpass -f ~/<yourpassword>.txt ssh-copy-id -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa.pub $name; done <serverlist.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment