#!/usr/bin/expect -f set user username set host ipaddress set password pwd set timeout -1 spawn ssh [email protected]$host expect "*assword:*" send "$password\r" interact
chmod +x shellname 使脚本生效
把shell所在路径加入环境变量:http://www.cnblogs.com/vontroy/p/5479889.html
在shell中直接使用shellname即可登录远程服务器
时间: 2024-10-05 23:50:02