免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: yuhuohu
打印 上一主题 下一主题

批量创建用户并设置密码的各种示例(含expect),感谢大师,感谢党,感谢CCTCV... [复制链接]

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
11 [报告]
发表于 2007-07-24 11:31 |只看该作者
原帖由 briangao 于 2007-7-23 23:35 发表
Won't work. telnet should expect an input from a terminal only.
expect is one way to deal with your need.


I tested that script on a SUN machine (Solaris 8 ) yesterday, it really worked. Of course I telneted on the SUN machine from my notebook first.

论坛徽章:
0
12 [报告]
发表于 2007-07-24 11:47 |只看该作者
原帖由 Philmoon 于 2007-7-24 11:31 发表


I tested that script on a SUN machine (Solaris 8 ) yesterday, it really worked. Of course I telneted on the SUN machine from my notebook first.



同意,经测试,确实可以用

论坛徽章:
0
13 [报告]
发表于 2007-07-24 18:20 |只看该作者
哈哈,expect也搞定了,感谢各位帮助

论坛徽章:
0
14 [报告]
发表于 2007-07-24 22:14 |只看该作者
Very interesting. I did a truss and it seems that telnet does take input from subshell. So my previous comment was wrong and I apologize for any confusion it causes.

论坛徽章:
0
15 [报告]
发表于 2007-07-24 22:48 |只看该作者
原帖由 briangao 于 2007-7-24 22:14 发表
Very interesting. I did a truss and it seems that telnet does take input from subshell. So my previous comment was wrong and I apologize for any confusion it causes.


老高的研究精神值得学习!

论坛徽章:
0
16 [报告]
发表于 2007-07-24 23:17 |只看该作者
Thanks for sharing your solutions.

论坛徽章:
0
17 [报告]
发表于 2007-07-25 09:17 |只看该作者
非常实用的方法

论坛徽章:
0
18 [报告]
发表于 2007-08-21 22:05 |只看该作者
楼主好,问个问题
我的solaris安装了下面相关的五个包
expect-5.43.0-sol10-x86-local.gz

coreutils, tcl-8.5a4, tk-8  gcc-3.4.6 or later.
目录在/usr/local下
要运行expect还需要什么配置或者操作吗/
这是我的脚本

#!/usr/local/bin/expect
set timeout 20
spawn telnet 192.168.52.128
expect "login:"
send "root"
expect "Password:"
send "tornado"
每次都报错说找不到spawn,expect
为什么/
我该怎么配置啊、
谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP