在你电脑的任意位置创建自动登录的脚本
- touch itermSsh.sh
- vim itermSsh.sh
- shell
#!/usr/bin/expect -f
set user _user
set host _host
set password _password
set timeout -1
spawn ssh $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof
tip:替换_user用户名, _host服务器地址, _password密码
- 打开iTerm的Preferences -> 切换到Profiles Tab -> new profile -> 在Command那一个输入框内写上itermSsh.sh的路径就可以。
- 然后new Tab的时候选择你创建的profile