in reply to Re: Net::OpenSSH multiple commands
in thread Net::OpenSSH multiple commands

Thanks Salva for your response

I'm running

Fedora release 9 (Sulphur)

Perl v5.10.0 built for i386-linux-thread-multi

openssh-5.1p1

Local SSH client is OpenSSH_5.1p1, OpenSSL 0.9.8g 19 Oct 2007

Remote SSH server is OpenSSH_2.5.2p2, SSH protocols 1.5/2.0

Debug output is as follows:
# call args: ['ssh','-S','/home/cstrong/.libnet-openssh-perl/root-10.2 +24.138.142-26522-522395','-o','User=root','--','10.224.138.142','ps - +ef'] # open_ex: ['ssh','-S','/home/cstrong/.libnet-openssh-perl/root-10.224 +.138.142-26522-522395','-o','User=root','--','10.224.138.142','ps -ef +'] Connection to 10.224.138.142 closed by remote host. # set_error(5 - child exited with code 255) # DESTROY(Net::OpenSSH=HASH(0x949885c), pid => 26523) # call args: ['ssh','-O','exit','-S','/home/cstrong/.libnet-openssh-pe +rl/root-10.224.138.142-26522-522395','-o','User=root','--','10.224.13 +8.142'] # open_ex: ['ssh','-O','exit','-S','/home/cstrong/.libnet-openssh-perl +/root-10.224.138.142-26522-522395','-o','User=root','--','10.224.138. +142'] # set_error(5 - child exited with code 255)

Replies are listed 'Best First'.
Re^3: Net::OpenSSH multiple commands
by cstrong (Beadle) on Sep 18, 2009 at 15:28 UTC
    Sorry, forgot to say that the debug ouput just posted is shown after the output of the first "ps -ef" - i.e. the important bit!
Re^3: Net::OpenSSH multiple commands
by salva (Canon) on Sep 18, 2009 at 20:06 UTC
    Remote SSH server is OpenSSH_2.5.2p2, SSH protocols 1.5/2.0

    That's quite old (~2001) and probably the cause of your problems... the only workaround besides upgrading the server would be to open a new connection for every command.

    Anyway, you (or the corresponding party) should upgrade the server software even if only for security reasons!

      I know it's an old thread but...

      I'm having the exact same issue, what exactly do you mean with "to open a new conection"? Do you mean using the new method once more?

      Thanks in advance!

        For every command you want to run on the remote host, create a new Net::OpenSSH object.