Create automatic login scripts anywhere on your computer

  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
Copy the code

Tip: Replace the _user user name, _host server address, and _password password

  1. Open iTerm Preferences -> Switch to Profiles Tab -> New profile -> Write the path of itermssh.sh in the Command input box.

  1. Then on New Tab, select the profile you created