????##### ????????ssh????? #####
?????????????expect?????yum????
????????????????ssh?????
batch_sshkey.sh
==============================================================
#!/bin/bash
cd /root
cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys
for i in `cat ip.txt`
do
ip=$(echo "$i"|cut -f1 -d":")
password=$(echo "$i"|cut -f2 -d":")

expect -c "
spawn scp /root/.ssh/authorized_keys /root/remote_operate.sh  root@$ip:/tmp/
expect {
"*yes/no*" {send "yes "; exp_continue}
"*password*" {send "$password "; exp_continue}
"*Password*" {send "$password ";}
}
"
expect -c "
spawn ssh root@$ip "/tmp/remote_operate.sh"
expect {
"*yes/no*" {send "yes "; exp_continue}
"*password*" {send "$password "; exp_continue}
"*Password*" {send "$password ";}
}
"
done
============================================================
ip.txt???????IP??????????????e??????
192.168.8.23:123456
192.168.8.24:456789
============================================================
remote_operate.sh
#!/bin/bash
if [ ! -d /root/.ssh ];then
mkdir /root/.ssh
fi
cp /tmp/authorized_keys /root/.ssh/

==========================================================
????????batch_sshkey.sh???ɡ?
????batch_sshkey.sh??????????????./??У???й????????譴????????????????