Verifying server signature. Waiting for NEWKEYS message. Enabling incoming encryption/MAC/compression. Send NEWKEYS, enable outgoing encryption/MAC/compression. Sending request for user-authentication service. #### Connection closed by remote host. at /usr/lib/perl5/site_perl/5.8.0/Net/SSH/Perl/AuthMgr.pm line 43 #### #!/usr/bin/perl -w use strict; use Net::SSH::Perl; my $sshusername = "anthski"; my $sshpasswd = "somepassword"; my $host = "192.168.0.1"; my $command = "date"; my $ssh = Net::SSH::Perl->new($host, debug => 1, protocol => 2); my $loginStatus = $ssh->login($sshusername,$sshpasswd); my $stdout; my $stderr; my $exit; eval { ($stdout,$stderr,$exit) = $ssh->cmd($command); }; if ($@) { if ($@ =~ m/Permission denied/i) { print "Authentication failed\n"; exit 1; } } print "$stdout\n";