iTerm2 快速登录 ssh

2019-05-07 11:17:29 浏览数 (12)

首先,编写登录脚本 login.exp 放在 ~/Documents/config/ 目录下:

代码语言:javascript复制
#!/usr/bin/expect

set timeout 30
spawn ssh -p 28743 [lindex $argv 0]@[lindex $argv 1]
expect {
        "(yes/no)?"
        {send "yesn";exp_continue}
        "password:"
        {send "[lindex $argv 2]n"}
}
interact

其次,在 iTerm 内进行设置:

ssh.png

使用快捷键 Ctrl Cmd B 即可快速登录。

0 人点赞