首页 > 系统服务 > 详细

shell脚本 expect 实现自动登陆

时间:2017-08-01 13:18:38      阅读:260      评论:0      收藏:0      [点我收藏+]
vi auto_ssh.exp
#!/usr/bin/expect
 
set ipaddress "123.227.159.159"
set passwd "你的密码"
set timeout 30
 
spawn ssh root@$ipaddress
 
expect {
"yes/no" {send "yes\r";exp_continue}
"password" {send "$passwd\r"}     #必须要加\r
}
interact

shell脚本 expect 实现自动登陆

原文:http://www.cnblogs.com/rayong/p/7267714.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!