Re: SFTP example or documentation
Date: Sun, 19 Aug 2007 01:23:34 -0400
On Aug 19, 2007, at 12:44 AM, Mathew Simon wrote:
> 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
> but it aborts due to some reason. The verbose output I got is quoted
> below and it doesn't mean much.
I do not know of one. Then again, I have not looked at the libcurl
docs or google'd for one in a while.
> 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
When debugging ssh-related problems, I find that running sshd with
the -d flag gives a good idea of why a connection attempt is failing
(Or succeeding!). If you need more verbose output, give it another -
d. Running with 3 -d flags is not recommended unless you are running
under script(1) or logging the output via some other mechanism, as it
produces TONS of output.
> 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,
> Using a SFTP client program like "WinSCP", I am able to connect to
> 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.
This would validate that the sshd is sane. Give sshd the -d flag(s).
/* Andre Guibert de Bruet * 436f 6465 2070 6f65 742e 2042 6974 206a */
/* Code poet / Sysadmin * 6f63 6b65 792e 2053 7973 4164 6d69 6e2e */
/* GSM: +1 734 846 8758 * 2055 4e49 5820 736c 6575 7468 2e00 0000 */
/* WWW: siliconlandmark.com * C/C++, Java, Perl, PHP, SQL, XHTML, XML */
Received on 2007-08-19