Script that transfers over the trusted keys to remote hosts and scp or rsync in multiple hosts in parallel from a remote host
I've never logged into before via ssh, but it also cats the trusted key into the ~/.ssh/authorized_ksys file. Essentially it would be like combining the two scripts below. 1. Create a script 1 with following: #!/bin/bash set -x HOST_FILE=$1 for SERVER in `cat $HOST_FILE` do if ping -c 1 ${SERVER} |grep "100% packet loss" then : else sshpass -p 'password' scp /root/.ssh/id_rsa.pub root@${SERVER}:/tmp sshpass -p 'password' scp script1 root@${SERVER}:/tmp sshpass -p 'password' ssh root@${SERVER} "chmod 755 /tmp/script1;/tmp/script1" fi done 2. Create 2nd script of name script1 with following: #!/bin/bash set -x if [ ! -d /root/.ssh ] then mkdir /root/....