expect ssh首次登录自动判断 yes/no

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               
v-lhb-prx01:/root/sbin# sh ./expect.sh spawn ssh root@192.168.32.16The authenticity of host '192.168.32.16 (192.168.32.16)' can't be established.RSA key fingerprint is da:3a:61:09:e4:f6:46:d7:01:08:1a:6c:b9:41:e8:4c.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '192.168.32.16' (RSA) to the list of known hosts.root@192.168.32.16's password: Last login: Wed May 27 09:37:32 2015 from 192.168.33.107v-dev-redis02:/root# df -hFilesystem                Size  Used Avail Use% Mounted on/dev/mapper/vg00-lv_root  7.75.61.877% /tmpfs                     499M     0  499M   0% /dev/shm/dev/sda1                 194M   2915516% /bootv-dev-redis02:/root# exitlogoutConnection to 192.168.32.16 closed.-----------------------------------------------------------------------------------expect {    "(yes/no)?" {        send "yes\n"        expect "password:"        send "$passwd\n"    }        "password:" {        send "$passwd\n"    } }# 下面测试是否登录到 expect "#" send "df -h\n"send "exit\r"expect eof

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow
这里写图片描述
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值