#!/usr/bin/expect
set ip 192.168.1.3
set user root
set pass "123456"
spawn ssh $user@$ip
expect "(yes/no)?" {
send "yes\r"
expect "password:"
send "$pass\r"
} "password:" { send "$pass\r" }
expect "#"
send "exit\r"
文章标签 expectj交互式登录ssh 文章分类 服务器
#!/usr/bin/expect
set ip 192.168.1.3
set user root
set pass "123456"
spawn ssh $user@$ip
expect "(yes/no)?" {
send "yes\r"
expect "password:"
send "$pass\r"
} "password:" { send "$pass\r" }
expect "#"
send "exit\r"
上一篇:linux源码升级内核
交互式脚本
sshpass+expect解决交互式问题
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M