Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Net::OpenSSH error message

by czachary (Initiate)
on Oct 08, 2009 at 19:06 UTC ( [id://800071]=perlquestion: print w/replies, xml ) Need Help??

czachary has asked for the wisdom of the Perl Monks concerning the following question:

Hello everyone,

I am new to coding in Net::OpenSSH. When running the code below, I received the following message after the output was displayed. "Killed by signal 1" Does anyone know what could be causing this message and how to correct it?

Thanks

My Code:

use Net::OpenSSH; my $host ='host'; my $user = 'user'; my $password = 'passwd'; my $ssh = Net::OpenSSH->new(host => $host, user => $user, password => +$password, ssh_cmd => '/usr/bin/ssh'); $ssh->error and die "SSH connection failed: " . $ssh->error; my $rv = $ssh->system("ls -l"); print "$rv\n";

Replies are listed 'Best First'.
Re: Net::OpenSSH error message
by dmlond (Acolyte) on Oct 08, 2009 at 20:07 UTC

    what happens when you run:

    ssh user@host ls -l

    Does it work? If you are on a mac or linux machine, you should be able to run that from the commandline. If you are using something like putty or XWin32 from a windows machine, you should be able to use the graphical client to program the 'ls -l' command to run

Re: Net::OpenSSH error message
by salva (Canon) on Oct 08, 2009 at 20:22 UTC
    Turn debugging on ...
    $Net::OpenSSH::debug = -1;
    ... and post here the output.

    Tell us also the version of the OS, OpenSSH, perl and Net::OpenSSH installed on the machine.

Re: Net::OpenSSH error message
by Wiggins (Hermit) on Oct 09, 2009 at 12:49 UTC
    Just going out on a limb... I haven't used the OpenSSH module. "signal 1" is SIGHUP I believe. The is the "hangup" signal created when a controlling terminal disconnects from a running program (or a modem connection was terminated). In the old days, the command 'nohup' was used:
    > nohup keep_running_after_I_hangup
    Was used to trap the the SIGHUP and keep the child (it had spawned) processing after the modem line hung up (or the xterm closed).

    Maybe something in the openSSH package is detecting the far end connection closing the socket (after piping the results back) and and treating it as a 'hangup/disconnect'.

    It is always better to have seen your target for yourself, rather than depend upon someone else's description.

      Net::OpenSSH uses the HUP signal to kill the master SSH process when it does not exit "voluntarily" (probably it should be using TERM).

      Anyway, I would like to see the debugging output to ensure that this is the cause of the problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://800071]
Approved by zwon
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-19 11:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found