- 论坛徽章:
- 1
|
错误信息: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
代码- #!/usr/bin/env perl
- use Net::SSH::Expect;
- use strict;
- my $i;
- my $command=$ARGV[1];
- for($i=0;$i<$ARGV[0];$i++){
- my $ip=$ARGV[$i+2];
- print $ip;
- my $ssh=Net::SSH::Expect->new(
- host => $ip,
- password => '******',
- user => 'root',
- raw_pty => 1
- );
- $ssh->login();
- #if ($login_output !~ /Weclome/){
- # die "Login has failed.Login output was $login_output";
- #}
- my $job=$ssh->exec($command);
- print ($job);
- $ssh->close();
- }
复制代码 $./ssh.pl 2 "ls -l /" "node1" "node2" |
|