1. 下载安装iTerm2
2. 点击profiles,选择open profiles
3. 选择 编辑 profiles
4. 在profiles选择中,点击+,创建profiles,输入Name,在command中选择 command: 输入
expect ~/.ssh/centos02
其中 centos02 是自定义文件的名称
5. 在访达中选择: 前往 -> 前往文件夹 -> 输入
~/.ssh/
6. 创建文件,输入以下内容
其中 password 中对应的是 pem 文件的地址
set user 用户名
set host ip地址
set password ~/.ssh/xx.pem
spawn ssh -i $password $user@$host
interact
expect eof
7. 保存退出
8. 使用: 打开 iTerm2 , 点击 profiles ,选择之前创建的profiles 选择,双击就可以了