in reply to Net::OpenSSH multiple commands

I can't see anything wrong in your script!

Net::OpenSSH has a debug mode that will tell you what's going on. Just add the following line at the beginning of your script:

$Net::OpenSSH::debug = -1;
Also, can you tell us the versions of the software you are using, including the OS, perl, Net::OpenSSH, the local SSH client and the remote SSH server?

Replies are listed 'Best First'.
Re^2: Net::OpenSSH multiple commands
by cstrong (Beadle) on Sep 18, 2009 at 15:26 UTC
    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)
      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!

      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!