自动登陆服务器脚本,不配置密钥的情况下用

#!/usr/bin/expect -f
#SSH登录我的服务器
#下一行表示使用expect包
set timeout 30 
spawn ssh <用户名>@<服务器ip> -p<端口号>
expect "password:"
send "<服务器密码>\n"
interact
exit

猜你喜欢

转载自blog.csdn.net/weixin_43069769/article/details/109613309