Skip to content

Instantly share code, notes, and snippets.

@xiexianbin
Created May 2, 2018 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xiexianbin/0255a4d11f55a6b26911f0434369f0d0 to your computer and use it in GitHub Desktop.
Save xiexianbin/0255a4d11f55a6b26911f0434369f0d0 to your computer and use it in GitHub Desktop.
#!/bin/bash
ssh-keygen -t rsa -b 2048 -N "" -f $HOME/.ssh/id_rsa
cat $HOME/.ssh/id_rsa.pub >$HOME/.ssh/authorized_keys
chmod 600 $HOME/.ssh/authorized_keys
for ip in $(awk '{print $1}' install.config); do
rsync -av -e 'ssh -o StrictHostKeyChecking=no' $HOME/.ssh/authorized_keys root@$ip:$HOME/.ssh/
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment