一、填寫iterm2的配置文件

1.png
二、在家目錄添加配置文件 ~/.ssh
- 新建配置文件
touch centos7 - 配置文件中添加一下內(nèi)容
#!/usr/bin/expect -f
set host 192.168.100.119(服務(wù)器ip地址)
set user root(登錄服務(wù)器的用戶名)
set password admin(登錄服務(wù)器的密碼)
#set timeout -1
spawn ssh $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof
三、此時已經(jīng)配好了,可以自動連接

2.png