cd ~/.ssh/
touch banwagong
vim banwagong
#!/usr/bin/expect -f set user 用户名 set host IP/域名 set port 端口号 set password 密码 set timeout -1 spawn ssh $user@$host -p $port expect "*assword:*" send "$password\r" interact expect eof

1、 点击新建
2、给当前名字命名
3、选择command
4、expect ~/.ssh/banwagong
原文:https://www.cnblogs.com/qianmaoliugou/p/13214387.html