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

HI,
My client scrip connect to remote ssh server, and execute perl scrip.   Remote STDOUT and remote STDERR redirect to local file.

**** sbackup.pl
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"); }
****bufile.pl
print(STDERR "TAR START...\n"); system("tar -cmvzf /tmp/large.tgz /tmp/largedir"); print(STDERR "TAR END.\n");
after (1 hour) server sent this message:
Apr 27 16:22:38 mylinux sshd32703: debug1: need rekeying
Apr 27 16:22:38 mylinux sshd32703: debug1: SSH2_MSG_KEXINIT sent

and client log:
mylinux: channel 1: window 14729 sent adjust 18039
mylinux: channel 1: window 1655 sent adjust 31113
mylinux: Warning: ignore packet type 20

...and data transfer stop

janitored by ybiC: Balanced <code> tags around codeblock, and balanced <tt> tags around error and log text

Replies are listed 'Best First'.
Re: net::ssh:perl - sshd: debug1: need rekeying
by wazoox (Prior) on Apr 27, 2005 at 16:22 UTC
    Looks like your sshd server regenerates the session key at some interval. That's not unusual, that's a security feature. This shouldn't break your connection however, does it?
      Yes, I Know :),

      But, data trasnfer hang.

      sshd_conf:
      ....
      #KeyRegenerationInterval 3600
      KeyRegenerationInterval 600
      ....

      i tried both
        Well, I have no idea... Did you try to open an ssh connection, let it open and wait to see what's happening?