Reputation: 41
I my trying to connect via SSH, and getting error message "Killed by signal 1."
This is my code.
use CGI;
use Net::OpenSSH;
my $machineCon = 'my-server';
my $username = 'my-username';
my $password = 'my-password';
$ssh_obj = Net::OpenSSH->new(
$machineCon,
strict_mode => 0,
master_opts => [-o => "StrictHostKeyChecking=no"],
ctl_dir => "/tmp/",
timeout => 200,
strict_mode => 0,
user => $username,
password => $password,
ssh_cmd => '/usr/bin/ssh'
);
if( !$ssh_obj->error )
{
# Is my process running?
my $PROC = $ssh_obj->capture( "pwd" );
print $PROC;
}
else
{
print $ssh_obj->error
}
I have looked many comments, but it is not help me. Any advice. Thanks
Upvotes: 0
Views: 1923
Reputation: 110
You should add this option in your new() method call.
kill_ssh_on_timeout => 0
If your code doesn't timeout now, then you know there is a connectivity issue.
And for more help, just add this line to see all errors:
$Net::OpenSSH::debug = ~0;
Upvotes: 1