美文网首页
mac shell脚本自动登陆远程服务器

mac shell脚本自动登陆远程服务器

作者: 来一碗花甲粉 | 来源:发表于2019-03-16 21:32 被阅读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

相关文章

网友评论

      本文标题:mac shell脚本自动登陆远程服务器

      本文链接:https://www.haomeiwen.com/subject/jqfemqtx.html