cURL / Mailing Lists / curl-users / Single Mail


Re: SFTP with C

From: Dan Fandrich <>
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:

> 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:
Received on 2016-10-08