Mac Item2自动远程连接服务器

时间:2023-03-09 07:17:56
Mac Item2自动远程连接服务器

Mac Item2自动远程连接服务器

1.编写脚本

vi test

#!/usr/bin/expect

set PORT 端口
set HOST ip
set USER root
set PASSWORD 密码 spawn ssh -p $PORT $USER@$HOST
expect {
"yes/no" {send "yes\r";exp_continue;}
"*password:*" { send "$PASSWORD\r" }
}
interact

2.配置文件

Prefences —> Profiles 中 新增 profile

在新增的profile设置command 选择command 后面跟 expect +(第一步新建文件地址)