iterm ssh脚本

2022/01/09 iterm 共 321 字,约 1 分钟
漆黑之牙

iterm ssh脚本

1脚本

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

chmod +x item2login.sh,将脚本移动到环境路径中,非必须

之后可通过命令快速ssh连接服务器

~/.ssh/item2login.sh 22 用户 ip 密码

将这个命令配置在 Iterm -> Profiles -> Command 中. 打开这配置时,会话将自动连接服务器

文档信息

Search

    Table of Contents