cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: SFTP support in Open Source Version

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Sat, 3 Jul 2010 08:55:49 +0200

On Saturday 03 of July 2010 03:07:51 Paul Romero wrote:
> I downloaded and successfully compiled the libcurl source code
> --the version from the file curl-7.21.0.tar.gz. After that I

'successfully compiled' does not imply that you have compiled in all the
possible features of libcurl. You can check what your build supports e.g.
by 'curl --version'. You should also see some summary as soon as the
configure script has finished (of course if you used the configure script
-- there are some alternatives to that). Another way is to use the
'curl-config' script to see what is supported, if it runs on your system.

> tried the following:
>
> curl -u paulr@rcom-software.com sftp://home/paulr/x --libcurl ex.c
>
> It produced a diagnostic indicating the SFTP is disabled or
> not supported. I think this means you need a commercial
> version of libcurl to get SSH2 SFTP support.

Nope, that's really not necessary in order to have SFTP supported. You
just need to build libcurl against the libssh2 library [1], which is
also available for free.

> The primary reason I need libcurl is to be able to perform
> SFTP operations from a C program non-interactively.
> Can libcurl do that reliably and is there some sample code

I think libcurl can manage it fairly well. If not, feel free to report
here any issues you encounter eventually.

> one could examine ? Also, using a commercial version is
> not a problem.

I am not sure if there are some special examples focused on the SFTP
protocol, but you may start by the related test-cases:

$ cd tests
$ ./runtests.pl -l | grep SFTP
test 600...[SFTP retrieval]
test 602...[SFTP put]
test 604...[SFTP retrieval of nonexistent file]
test 606...[SFTP invalid user login]
test 608...[SFTP post-quote rename]
test 609...[SFTP post-quote mkdir failure]
test 610...[SFTP post-quote rmdir]
test 611...[SFTP post-quote rename]
test 612...[SFTP post-quote remove file]
test 613...[SFTP directory retrieval]
test 614...[SFTP pre-quote chmod]
test 615...[SFTP put remote failure]
test 616...[SFTP retrieval of empty file]
test 618...[SFTP retrieval of two files]
test 620...[SFTP retrieval of missing file followed by good file]
test 622...[SFTP put failure]
test 624...[SFTP put with --ftp-create-dirs]
test 625...[SFTP put with --ftp-create-dirs twice]
test 626...[SFTP invalid quote command]
test 627...[SFTP quote remove file with NOBODY]
test 628...[SFTP invalid user login (password authentication)]
test 630...[SFTP incorrect host key]
test 632...[SFTP syntactically invalid host key]
test 633...[SFTP retrieval with byte range]
test 634...[SFTP retrieval with byte range past end of file]
test 635...[SFTP retrieval with byte range relative to end of file]
test 636...[SFTP retrieval with X- byte range]
test 637...[SFTP retrieval with invalid X- range]
test 2004...[TFTP RRQ followed by SFTP retrieval followed by FILE followed by
SCP retrieval then again in reverse order]

Kamil

[1] http://www.libssh2.org/
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-03