自动登陆远程服务器shell

#!/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

相关文章
相关标签/搜索