mac shell脚本自动登陆远程服务器
2019-03-16 本文已影响0人
来一碗花甲粉
省去每次都要输入地址密码的麻烦
198login.sh
#!/usr/bin/expect -f
set user "name"
set host "xxx.xxx.xxx.xxx"
set password "123456"
set timeout -1
spawn ssh $user@$host
expect "*assword:*"
send "$password\r"
interact
expect eof
执行
chmod +x 198login.sh
./198login.sh