Ask the sysadmin of the remote machine if they would be willing to set up a second sshd on another port with logging cranked up so that you can test. It's worth a shot. Otherwise, you need to step through to find the part that is breaking your code.

Begin at the beginning. First, confirm that you can get Net::SSH::Perl working:

my $ssh = Net::SSH::Perl->new("host1", protocol=>2, debug=>1); $ssh->login("user1", "pass1"); ($out, $err, $exit) = $ssh->cmd("hostname"); print "Out: $out$/Err: $err$/Exit: $exit$/";

If that doesn't return the hostname (modulo any syntax errors ... I didn't test the code), then there is something wrong with the server.

From there, step through the Net::SFTP code until you find the bit that breaks it. (extract follows)

sub do_init { my $sftp = shift; my $ssh = $sftp->{ssh}; $sftp->debug("Sending SSH2_FXP_INIT"); my $msg = $sftp->new_msg(SSH2_FXP_INIT); $msg->put_int32(SSH2_FILEXFER_VERSION); $sftp->send_msg($msg); $msg = $sftp->get_msg; my $type = $msg->get_int8; if ($type != SSH2_FXP_VERSION) { croak "Invalid packet back from SSH2_FXP_INIT (type $type)"; } my $version = $msg->get_int32; $sftp->debug("Remote version: $version"); ## XXX Check for extensions. } . . . sub send_msg { my $sftp = shift; my($buf) = @_; my $b = Net::SFTP::Buffer->new; $b->put_int32($buf->length); $b->append($buf->bytes); $sftp->{channel}->send_data($b->bytes); }

Good luck bughunting ...


My parents just came back from a planet where the dominant life form had no
bilateral symmetry, and all I got was this stupid F-Shirt.

In reply to Re: Re: Re: SFTP hangs (winxp) by idsfa
in thread SFTP hangs (winxp) by rkg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.