免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5224 | 回复: 3
打印 上一主题 下一主题

Net::SSH::Expect SSHAuthenticationError Login timed out. [复制链接]

论坛徽章:
1
申猴
日期:2014-04-18 16:29:14
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-09-29 10:12 |只看该作者 |倒序浏览

错误信息:SSHAuthenticationError Login timed out. The input stream currently has the contents bellow:  at /usr/lib/perl5/site_perl/5.8.8/Expect.pm line 828
代码
  1. #!/usr/bin/env perl
  2. use Net::SSH::Expect;
  3. use strict;

  4. my $i;
  5. my $command=$ARGV[1];
  6. for($i=0;$i<$ARGV[0];$i++){
  7.         my $ip=$ARGV[$i+2];
  8.         print $ip;
  9.         my $ssh=Net::SSH::Expect->new(
  10.                 host => $ip,
  11.                 password => '******',
  12.                 user => 'root',
  13.                 raw_pty => 1
  14.         );
  15. $ssh->login();
  16. #if ($login_output !~ /Weclome/){
  17. #       die "Login has failed.Login output was $login_output";
  18. #}
  19.         my $job=$ssh->exec($command);
  20.         print ($job);
  21.         $ssh->close();
  22. }
复制代码
$./ssh.pl 2 "ls -l /" "node1" "node2"

论坛徽章:
1
申猴
日期:2014-04-18 16:29:14
2 [报告]
发表于 2010-09-29 10:32 |只看该作者
这个问题是解决了,是他们在给node间的ssh登入配置了互信,所以用without password的方式就可以了。


我还有个问题,想打包这个小程序是不是只能把(Net::SSH::Expect.pm,Expect 1-12.pm,IO::Tty.pm三个模块和ssh.pl放在同一文件夹中,在require),有更方便的模块或者方法不?

论坛徽章:
1
申猴
日期:2014-04-18 16:29:14
3 [报告]
发表于 2010-09-30 11:28 |只看该作者
新问题:thread failed to start: SSHConnectionAborted 。
是不是net::ssh::expect内部就是开了个进程,所以多线程执行net::ssh::expect->exec()就会报错?

论坛徽章:
0
4 [报告]
发表于 2010-12-13 15:32 |只看该作者
回复 2# Mr-Summer


    哥们,什么意思??怎么解决的?without??能否解释一下。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP