请教一个关于 macos 下 iterm2 通过 expect 脚本登录同一台服务器卡死的问题
<p>问题:首次打开 ssh 窗口无问题,但是打开同一台服务器的第二个 ssh 窗口后显示连接上,但是无法正常输入,类似于卡死的情况,换连接其他服务器也是同样的情况,只能打开一个窗口,我的 iterm2 profile 配置如下</p>
<p>具体操作: 1 、配置.ssh 目录下的配置文件,如下</p>
<pre><code class="language-sh">#!/usr/bin/expect -f
set host x.x.x.x
set user root
set port 22
set password password
set timeout -1
spawn ssh -p$port <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f5d180869087b5">[email protected]</a>$host
expect "*password:*"
send "$password\r"
interact
expect eof
</code></pre>
<p>2 、新建 iterm2 的 profile 文件</p>
<p>在 Command 处选择<code>Command</code> ,填写 <code>expect ~/.ssh/xxxconfig</code>,Working Directory 选择 Home directory</p>
<p>3 、使用</p>
<p>在 iterm2 窗口按快捷键 cmd+o 选择 profile 直接登录 ssh</p>
收藏(0)
分享
相关标签:
注意:本文归作者所有,未经作者允许,不得转载