in reply to Net::SSH2 woes
Perhaps the undef $ssh; is unecessary.use strict; use Net::SSH2; my $hf = 'list.txt'; my $user = 'user'; my $pass = 'pass'; open (L,"<$hf") || die "$!"; while(<L>) { chomp $_; my $ssh = Net::SSH2->new(); $ssh->debug(1); print "Connecting now..\n"; $ssh->connect("$_") || warn "$!"; $ssh->auth_password("$user","$pass"); my $chan = $ssh->channel(); $chan->exec('dir'); $chan->close(); undef $ssh; } close L;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Net::SSH2 woes
by ig (Vicar) on Jul 03, 2012 at 06:32 UTC | |
|
Re^2: Net::SSH2 woes
by vdubjunkie (Novice) on Jul 03, 2012 at 17:55 UTC |