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

Good morning. I have a test CGI script to create and debug SFTP connections. It runs on a Windows host. Briefly, it looks like:

#!/usr/bin/perl -w

use strict;

use CGI;
use Net::SFTP;

my $host = '<remote host>';
my $login = '<username>';
my $password = '<password>';
my $port = <remote port>;

. . .

my $sftp = Net::SFTP->new($host,
   user => $login,
   password => $password,
   debug => 1,
   ssh_args => port => $port
);

When I attempt to run the script for one particular remote host it appears as if the script successfully connects but then:
   snapple: sftp: Sending SSH2_FXP_INIT
   Use of uninitialized value in numeric gt (>) at D:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 82.
   Use of uninitialized value in pack at D:/Perl/site/lib/Net/SSH/Perl/Buffer.pm line 105.
   Connection closed at D:\Web\NPG\admin\cgi-bin\NetSFTPTest.pl line 24

Is anyone familiar with this? Any ideas on where to look or what to change?

Thanks in advance.

dcoleman

  • Comment on Net::SFTP issue -- uninitialized value in Net/SSH/Perl

Replies are listed 'Best First'.
Re: Net::SFTP issue -- uninitialized value in Net/SSH/Perl
by Anonymous Monk on Dec 03, 2007 at 12:36 UTC
    you should enclose your code in code tags:  <code> ... </code> or  <c> ... </c>.

    as it stands, it looks like part of the line that appears as "ssh_args => port => $port" is being interpreted as markup.

      Sorry for the formatting issues. First time I have posted here.
        A bit of additional information. I ran the SFTP test script against a host that I know it can connect to. In that case the tail end of the output looks like:
           snapple: Requesting channel_open for channel 1.
           snapple: Sending subsystem: sftp
           snapple: Requesting service subsystem on channel 1.
           snapple: channel 1: open confirm rwindow 0 rmax 32768
           snapple: sftp: Sending SSH2_FXP_INIT
           snapple: sftp: Remote version: 3

        However, with the problem connection I get the following:
           snapple: Requesting channel_open for channel 1.
           snapple: channel 0: rcvd eof
           snapple: channel 0: output open -> drain
           snapple: channel 0: rcvd close
           snapple: channel 0: input open -> closed
           snapple: channel 0: close_read
           snapple: channel 0: obuf empty
           snapple: channel 0: output drain -> closed
           snapple: channel 0: close_write
           snapple: channel 0: send close
           snapple: channel 0: full closed
           snapple: sftp: Sending SSH2_FXP_INIT
           Use of uninitialized value in numeric gt (>) at D:/Perl/site/lib/Net/SSH/Perl/Channel.pm line 82.
           Use of uninitialized value in pack at D:/Perl/site/lib/Net/SSH/Perl/Buffer.pm line 105.

        Not too sure what that suggests but is it possible that the channel 1 open is somehow interfering with channel 0?

        Thanks.

        dcoleman

        that is why preview is mandatory, so thats no excuse