ITerm2脚本登陆ssh
ITerm2 设置脚本 免输入登陆SSH
Profiles => Open profiles => Edit profiles => Tags + => Command位置 => expect Path/脚本文件名
带证书 SSH脚本
#!/usr/bin/expect -f
set user root #用户名
set host YouHostIP #主机IP
set empath YouPATH/host.pem #证书存放位置
set timeout -1
spawn ssh -i $empath $user@$host
interact
expect eof
免密码 SSH脚本
#!/usr/bin/expect -f
set user root #用户名
set host YouHostIP #主机IP
set password YouPassword #密码
set timeout -1
spawn ssh $user@$host
expect {
"(yes/no)?"
{send "yes\n";exp_continue}
"password:"
{send "$password\n"}
}
interact
expect eof