#!/usr/bin/expect -f set user username set host ipaddress set password pwd set timeout -1 spawn ssh $user@$host expect "*assword:*" send "$password\r" interact
chmod +x shellname 使腳本生效html
把shell所在路徑加入環境變量:http://www.cnblogs.com/vontroy/p/5479889.htmlshell
在shell中直接使用shellname便可登陸遠程服務器bash