cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: SFTP with C

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Sat, 8 Oct 2016 14:31:21 +0200

On Sat, Oct 08, 2016 at 09:06:17AM -0300, Daniel Bernardo wrote:
> I'm trying to use SFTP instead FTP with Curl and C, to upload files.

The curl-library is a better list to use for libcurl questions.

> I started with the example ftpupload.c
>
> It works fine, but it has no option to use SSH.

SFTP/SCP are selected by choosing a sftp: or scp: URL scheme.
> I added this line to the code:

>
> curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES, CURLSSH_AUTH_AGENT);
>
> Just before these two lines:
>
> /* enable uploading */
> curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
>
> It works, but if I use "sftp://" instead "ftp://" it stops working.
> Of course, I don't know if it is using SFTP or not.

If the URL starts ftp:, it's not using SFTP. Are you sure you really want SFTP
and not FTPS?

> Please I need a working example or some extra information.
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-users
FAQ: https://curl.haxx.se/docs/faq.html
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-10-08