想搞一个使用ssh登录批量ip地址执行命令,自动输入密码的脚本,但是ssh不能使用标准输入来实现自动输入密码,于是了解到了expect这个可以交互的命令 是什么 查看使用man查看expect,是这么说的,使用谷歌翻译一下 Expect is a program that "talks" to other interactive programs according to a script. Following the script, Expect knows what can be…
1:简单的实现ssh登录 #!/usr/bin/expect set ip "10.0.0.142" set user "root" set password " spawn ssh $user@$ip expect { "yes/no"{ send "yes\n";exp_continue } "password:"{ send "$password\r"} } intera…