Mac实现iTerm2 免登陆ssh服务器

在你电脑的任意位置建立自动登陆的脚本shell

  1. touch itermSsh.sh
  2. vim itermSsh.sh
  3. 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密码vim

  1. 打开iTerm的Preferences -> 切换到Profiles Tab -> new profile -> 在Command那一个输入框内写上itermSsh.sh的路径就能够。

  1. 而后new Tab的时候选择你建立的profile
相关文章
相关标签/搜索