X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=0.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_BL_SPAMCOP_NET,RCVD_NUMERIC_HELO,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Andrew DeFaria Subject: Re: sshd - sftp problem (perl demo) Date: Mon, 26 Jul 2010 23:27:54 -0700 Lines: 86 Message-ID: References: <32E4B12749554BE2A202BD02E3053312 AT desktop2> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9pre) Gecko/20100217 Lightning/1.0pre Shredder/3.0.3pre In-Reply-To: <32E4B12749554BE2A202BD02E3053312@desktop2> X-Stationery: 0.5.1 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On 07/26/2010 10:36 PM, Sisyphus wrote: > Hi, > > I have the following perl script that attempts to connect (from native > Windows) to an sshd server (either localhost, which is a Cygwin sshd > server, or a remote linux host) > and create a Net::SSH2::SFTP object. > > ############################### > use warnings; > use Net::SSH2; > > my ($host, $user, $pass) = qw(blah blah blah); > > my $ssh2 = Net::SSH2->new; > die "can't connect" unless $ssh2->connect($host); > > print "Connected\n"; > > die "can't authenticate" > unless $ssh2->auth(username => $user, > password => $pass); > > print "Authenticated\n"; > > my $sftp = $ssh2->sftp; > print $sftp, "\n"; # Line 19 > > $ssh2->disconnect(); > ############################### > > Works fine when connecting to the sshd server on the remote linux box. > The script > then outputs: > > C:\_32\pscrpt\net-ssh2>perl cygwin.pl > Connected > Authenticated > Net::SSH2::SFTP=SCALAR(0x2a92594) > > But when I modify the script to connect to the Cygwin sshd server I get: > > C:\_32\pscrpt\net-ssh2>perl cygwin.pl > Connected > Authenticated > Use of uninitialized value $sftp in print at cygwin.pl line 19. > > No problem with the connection or the authentication, but the call to > $ssh2->sftp is clearly failing. Have you ever heard of the Perl debugger? Simply start your script with perl -d