cURL / Mailing Lists / curl-users / Single Mail


SFTP with C

From: Daniel Bernardo <>
Date: Sat, 8 Oct 2016 09:06:17 -0300

I'm trying to use SFTP instead FTP with Curl and C, to upload files.

I started with the example ftpupload.c

It works fine, but it has no option to use SSH.

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.

Please I need a working example or some extra information.

Thanks in advance,

List admin:
Received on 2016-10-08