博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
shell脚本 expect 实现自动登陆
阅读量:6863 次
发布时间:2019-06-26

本文共 269 字,大约阅读时间需要 1 分钟。

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

转载于:https://www.cnblogs.com/rayong/p/7267714.html

你可能感兴趣的文章