1. 使用Login shell方式:
item2 → Preferences → Profiles
修改设置vi ~/.ssh/config
Host *
ControlMaster auto
ControlPath ~/.ssh/%h-%p-%r
ControlPersist yes
Host bxdx
hostname relay.bxdx-int.com
user xxxx
2. 使用commond方式:
a. 在本地mac的/Users/xxxx/Documents/iterm2/bin下新建一个login_dev文件
#!/usr/bin/expect
set relay_host relay.bxdx-int.com
set username xxxx
set password XXXXXXX
set dev_host xxx@xxx.com
spawn ssh -l $username $relay_host
interact
b.在Iterm2中的profile配置执行该文件(不用每次登陆跳板机都输入密码)
c .创建~/.ssh/config文件,文件添加如下内容
Host *
ControlMaster auto
ControlPath ~/.ssh/%h-%p-%r
ControlPersist yes