Skip to content

Instantly share code, notes, and snippets.

@tonejito
Created January 24, 2019 20:03
Show Gist options
  • Save tonejito/23d0f6be8a87252dd6204b609adc0eab to your computer and use it in GitHub Desktop.
Save tonejito/23d0f6be8a87252dd6204b609adc0eab to your computer and use it in GitHub Desktop.
Copy ssh public key for mass deployments
{print " export SSHPASS=\""$2"\"; sshpass -e ssh-copy-id -o StrictHostKeyChecking=no -i "$3" root@"$1""}
#!/bin/bash -v
# Beware of -o StrictHostKeyChecking=no in awk file
awk -f copy-id.awk < hosts | bash -vx
192.0.2.1 password ~/.ssh/id_rsa.pub
example.com password ~/.ssh/id_rsa.pub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment