#!/usr/bin/perl use strict; use Net::SSH2; my $hf = 'list.txt'; my $user = 'user'; my $pass = 'pass'; my $ssh = Net::SSH2->new(); $ssh->debug(1); open (L,"<$hf") || die "$!"; while() { chomp $_; print "Connecting now..\n"; $ssh->connect("$_") || warn "$!"; $ssh->auth_password("$user","$pass"); my $chan = $ssh->channel(); $chan->exec('dir'); $chan->close(); } close L; #### # ./test.pl Connecting now.. libssh2_channel_open_ex(ss->session, pv_channel_type, len_channel_type, window_size, packet_size, ((void *)0) , 0 ) -> 0x841ed400 Net::SSH2::Channel::DESTROY Connecting now.. Resource temporarily unavailable at ./test.pl line 14, line 2. libssh2_channel_open_ex(ss->session, pv_channel_type, len_channel_type, window_size, packet_size, ((void *)0) , 0 ) -> 0x0 Can't call method "exec" on an undefined value at ./test.pl line 21, line 2. Net::SSH2::DESTROY object 0x8663b6c0