标签:txt dex ipaddr deploy /usr time key ssh bash
vi deploy_ssh_key.exp
#!/usr/bin/expect -f set timeout 2 set ipaddress [lindex $argv 0] set passwd "Pwd@123" spawn ssh-copy-id "-p2222 mds@$ipaddress" expect { "yes/no" { send "yes\r";exp_continue } "password:" { send "$passwd\r" } } expect "#"
for x in `cat ip.txt | awk ‘{print $1}‘`;do ./deploy_ssh_key.exp $x;done
标签:txt dex ipaddr deploy /usr time key ssh bash
原文地址:https://www.cnblogs.com/mulinux/p/9017979.html