#!/usr/bin/expect
set timeout
spawn ssh root@20.0.102.19
expect "password:"
send "123456\n"
interact
#!/usr/bin/expect
set timeout
spawn scp -r /root/authorized_keys root@20.0.102.19:/root/.ssh/authorized_keys
#将本地的authorized_keys拷贝到远端的/root/.ssh expect "password:"
send "123456\n"
interact
今天要用expect免密码登陆集群中节点,使用expect实现免密码登陆和scp.