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 中. 打开这配置时,会话将自动连接服务器
文档信息
- 本文作者:Yuanjia Weng
- 本文链接:https://github.wengyuanjia.fun//2022/01/09/iterm2/
- 版权声明:自由转载-非商用-非衍生-保持署名(创意共享3.0许可证)