delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/07/27/01:38:22

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.1 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <32E4B12749554BE2A202BD02E3053312@desktop2>
From: "Sisyphus" <sisyphus1 AT optusnet DOT com DOT au>
To: "cygwin" <cygwin AT cygwin DOT com>
Subject: sshd - sftp problem (perl demo)
Date: Tue, 27 Jul 2010 15:36:46 +1000
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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.

First thing that comes to mind is that I might need to install/run something
additional for SFTP to be enabled on Cygwin. All I've done is install
cygrunsrv and openssh, and then start the openssh server with 'net start
sshd'. Did I miss something ?

Second thing that comes to mind is that connecting via user cyg_server 
(using the password I created when I ran 'ssh-host-config -y') might not be 
the right thing to do. Is it ?

Third thing that comes to mind is that it might be permissions related.

Advice welcome.

I'm also unable to upload files to the Cygwin installation using SCP. 
(Again, no problems with SCP when connected to the remote linux box.)

Cheers,
Rob



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019