Expect基础
跳到导航
跳到搜索
添加pubkey
vi addkey #!/usr/local/bin/expect #SERVERS="101.00.208.197 120.40.043.52 " set timeout 5 set host [lindex $argv 0] spawn ssh-copy-id -i /home/evan/.ssh/id_rsa.pub root@$host #ssh-copy-id -i /home/evan/.ssh/id_rsa.pub [email protected] expect { "*yes/no" { send "yes\r"; exp_continue} "*password:" { send "P2xMGipLpSG7dA==\r" } } expect eof 用法 ./addkey 18.80.216.19 #这是你的IP