#!/bin/bash
#批量免密登陆(生产环境)
SERVERS="`cat /root/ip_list`"
function sshcopyid
{
expect -c "
set timeout -1;
spawn ssh-copy-id admin@$1;
expect {
\"(yes/no)?\" { send \"yes\r\" }
};
expect {
\"password:\" { send \"vhPRqmLZEUJ2L9WV\r\"}
};
expect eof;
"
}
for server in $SERVERS
do
sshcopyid $server
done