cURL / Mailing Lists / curl-library / Single Mail

curl-library

SFTP example or documentation

From: Mathew Simon <msimon_at_simdol.com>
Date: Sat, 18 Aug 2007 23:44:18 -0500

Hi,

Are there any example or documentation available on how to use LIBCURL
to implement a SFTP session either to upload or download a file or to
get a directory listing. I tried to use the curleasy with a URL of
sftp://..... I am able to make an initial connection to the SFTP server,
but it aborts due to some reason. The verbose output I got is quoted
below and it doesn't mean much.

Text: About to connect() to qa-ftp.xxx.com port 9922 (#0)
Text: Trying 66.xxx.xxx.43...
Text: connected
Text: Connected to qa-ftp.xxx.com (66.xxx.xxx.43) port 9922 (#0)
Text: Closing connection #0
Text: Error in the SSH layer

How do I get more info on the problem or other debugging info on the SSH
part? I am using the August-18 snapshot for both LIBCURL and LIBSSH2. I
used the following "setopts".

url = "sftp://qa-ftp.xxx.com";
curl_easy_setopt(pCurl->mpCurl, CURLOPT_URL, url);
curl_easy_setopt(pCurl->mpCurl, CURLOPT_USERPWD, FtpUserPasswd.c_str());
curl_easy_setopt(pCurl->mpCurl, CURLOPT_PORT, 9922);
curl_easy_setopt(pCurl->mpCurl, CURLOPT_SSH_AUTH_TYPES,
CURLSSH_AUTH_PASSWORD);

Using a SFTP client program like "WinSCP", I am able to connect to that
server and hence I know that my user-ID and password work and that my
Win-XP machine, which is behind a firewall, can successfully connect to
that Server of a major company.

Thanks,
Mathew Simon
Received on 2007-08-19