in reply to Re^2: net::ssh:perl - sshd: debug1: need rekeying
in thread net::ssh:perl - sshd: debug1: need rekeying

Well, I have no idea... Did you try to open an ssh connection, let it open and wait to see what's happening?
  • Comment on Re^3: net::ssh:perl - sshd: debug1: need rekeying

Replies are listed 'Best First'.
Re^4: net::ssh:perl - sshd: debug1: need rekeying
by Anonymous Monk on May 09, 2005 at 16:00 UTC

    sorry my english..:)

    thist shell command perfect work:
    $ ssh mylinux "tar -cmvz /tmp/mp3" | > /tmp/mp3.tgz<br>
    i think perl module bug (net::ssh::perl)
    full perl code:
    local file
    #!/usr/bin/perl -w use diagnostics; #use strict; use Net::SSH::Perl; use IO::Handle; open(FOUT, ">/tmp/test.out"); open(FERR, ">/tmp/test1.err"); ########################## $params{'protocol'} = '2'; $params{'port'} = '22'; $params{'debug'} = 'true'; $params{'interactive'} = 'false'; $params{'compression'} = 'false'; $params{'identity_files'} = [$ENV{HOME}."/.ssh/id_rsa"]; $params{'options'} = ["RSAAuthentication yes", "PasswordAuthentication no", "ConnectTimeout 10", "BatchMode yes", "FallBackToRsh no", "RhostsAuthentication no", "RhostsRSAAuthentication no", "KeepAlive yes"]; eval { if ( $sshconn = Net::SSH::Perl->new("localhost", %params)) { $sshconn->login('op'); $sshconn->register_handler("stdout", sub { my($outchannel, $outbuffer) = @_; print(FOUT $sshconn->type); }); $sshconn->register_handler("stderr", sub { my($errchannel, $errbuffer) = @_; print(FERR $errbuffer->bytes); }); ($ssherr, $ssherr, $sshexit) = $sshconn->cmd("/tmp/bufile.pl") +; $sshconn->cmd("exit"); } }; if ( $@ ) { warn $@; } close(FOUT); close(FERR);

    remote file:
    #!/usr/bin/perl -w use diagnostics; #use strict; use IO::Handle; STDOUT->autoflush(1); print(STDERR "TAR START...\n"); system("tar -cmvzf /tmp/mp3.tgz /home/op/mp3"); print(STDERR "TAR END.\n");

    logs:
    sshd:
    Apr 27 16:22:38 mylinux sshd[32703]: debug2: channel 1: rcvd adjust 18 +039 + Apr 27 16:22:38 mylinux sshd[32703]: debug2: channel 1: rcvd adjust 31 +113 + Apr 27 16:22:38 mylinux sshd[32703]: debug1: need rekeying + + Apr 27 16:22:38 mylinux sshd[32703]: debug1: SSH2_MSG_KEXINIT sent + + Apr 27 16:22:38 mylinux sshd[32703]: debug2: channel 1: rcvd adjust 18 +039

    ssh client (perl) debug output:
    mylinux: channel 1: window 1655 sent adjust 31113 mylinux: channel 1: window 14729 sent adjust 18039 mylinux: channel 1: window 1655 sent adjust 31113 mylinux: Warning: ignore packet type 20 mylinux: channel 1: window 14729 sent adjust 18039
    please try this code. what is the problem? thank you very much!
      I'm testing.... No problem so far (but I replaced the "remote script" by the simple straight commmand : tar czf  /tmp/toto.tgz /mnt/Musique/AlJarreau/Jarreau/
      May be the remote script is hosed... Why use "print STDERR"? You have "warn" for that, use it.
      BTW you didn't follow the Very Holy Golden Law : Always Use strict.
      Better change the code this way :
      #!/usr/bin/perl -w use strict; use diagnostics; #use strict; use Net::SSH::Perl; use IO::Handle; open(FOUT, ">/tmp/test.out"); open(FERR, ">/tmp/test1.err"); ########################## my ($sshconn, $ssherr, $sshexit); my %params = ( protocol => 2, port => 22, debug => 'true', interactive => 'false', compression => 'false', identity_files => [$ENV{HOME}."/.ssh/id_rsa"], options => [ "RSAAuthentication yes", "PasswordAuthentication yes", "ConnectTimeout 10", "BatchMode yes", "FallBackToRsh no", "RhostsAuthentication no", "RhostsRSAAuthentication no", "KeepAlive yes"] ); eval { if ( $sshconn = Net::SSH::Perl->new("localhost", %params)) { $sshconn->login('op'); $sshconn->register_handler("stdout", sub { my($outchannel, $outbuffer) = @_; print(FOUT $sshconn->type); }); $sshconn->register_handler("stderr", sub { my($errchannel, $errbuffer) = @_; print(FERR $errbuffer->bytes); }); ($ssherr, $ssherr, $sshexit) = $sshconn->cmd("/tmp/bufile.pl") +; $sshconn->cmd("exit"); } }; if ( $@ ) { warn $@; } close(FOUT); close(FERR);
        yes, but remote script is "backup agent". :)
        important that the remote STDERR and remote STDOUT redirect to local file.(posteriorly wrought the STDERR messages)
        tar czf /tmp/toto.tgz /mnt/Musique/AlJarreau/Jarreau/
        work fine here:) but data transfer not ssh tunel and remote created
        "tar cz /mnt/Musique/AlJarreau/Jarreau/"
        print file STDOUT and
        $sshconn->register_handler("stdout", sub { my($outchannel, $outbuffer) = @_; print(FOUT $sshconn->type); });
        redirect to local file. the mistake one hour after check in. please try who that way (one hour!!) (use strict OK - this only test :))
        see my code comments)
        thank you
      sorry ,
      remote file:
      #!/usr/bin/perl -w use diagnostics; #use strict; use IO::Handle; STDOUT->autoflush(1); print(STDERR "TAR START...\n"); system("tar -cmvz /home/op/mp3"); print(STDERR "TAR END.\n");