首页 > 代码库 > expect脚本免密码

expect脚本免密码

  1 #!/usr/bin/expect
  2 set timeout 10
  3 spawn ssh root@20.0.102.19
  4 expect "password:"
  5 send "123456\n"
  6 interact 
 1 #!/usr/bin/expect
  2 set timeout 10
  3 spawn scp -r root@20.0.102.19:/root/.ssh/authorized_keys /root/authorized_keys
  4 expect "password:"
  5 send "123456\n"
  6 interact

 

expect脚本免密码