您的位置:首页 > 运维架构 > Linux

linux 自动登录脚本

2015-08-25 17:38 766 查看
#!/usr/bin/expect

set port 22
set user xiaoming
set password xiaoming123
set host 111.222.22.33
set time 30

set timeout $time

spawn ssh -p $port $user@$host

expect {
"yes/no" {send "yes\r"}
"*password:*" {send "$password\r"}
}

expect eof

interact

#执行时不要用sh  要用expect
expect file or ./file


相关链接:http://blog.sina.com.cn/s/blog_5140741f01015w3j.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: