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 +(第一步新建文件地址)

posted @ 2020-09-08 09:04  GGuoLiang  阅读(147)  评论(0编辑  收藏  举报