iTerm 使用expect实现自动远程登录,登录跳板机
Posted 胡大叔
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iTerm 使用expect实现自动远程登录,登录跳板机相关的知识,希望对你有一定的参考价值。
#!/usr/bin/expect set timeout 10 spawn ssh -p [lindex $argv 0] [lindex $argv 1]@[lindex $argv 2] expect { "(yes/no)?" {send "yes\n";exp_continue} "password:" {send “<password>\n"} } expect “*<服务器名>*" {send "ssh [lindex $argv 3]@[lindex $argv 4]\n"} expect "*password:" {send "[lindex $argv 5]\n"} #expect eof interact
在mac上使用iTerm连接服务器,不能保存密码,通过expect脚本来实现自动密码输入
一般公司内部只能通过跳板机登录,通过上面的脚本可以实现连续登录 ,具体的iTerm配置参考网上其它教程
通过expect脚本还可以实现更复杂的自动化运维
参考:
http://blog.csdn.net/ofengyajie/article/details/17840751
以上是关于iTerm 使用expect实现自动远程登录,登录跳板机的主要内容,如果未能解决你的问题,请参考以下文章