in reply to Net::SSH::Perl - stops script execution on authentication failure

Net::SSH::Perl won't work the way that you're doing it. Just keep it simple:
#!/usr/bin/perl use strict; use warnings; use Net::SSH::Perl; connectToServer(); sub connectToServer { my $host = 'localhost'; my $username = 'user'; my $password = 'password'; my $cmd = 'chkconfig --list'; my $ssh = Net::SSH::Perl->new( $host, protocol => '2,1', debug => 1, ); $ssh->login( $username, $password ); my ( $stdout, $stderr, $exit ) = $ssh->cmd($cmd); print $stdout, "\n"; }
  • Comment on Re: Net::SSH::Perl - stops script execution on authentication failure
  • Download Code