cURL / Mailing Lists / curl-library / Single Mail


SFTP public key authentication

From: Mark Hessling <>
Date: Sun, 06 Jan 2013 21:04:11 +1000

I'm trying to use the SFTP protocol of curl to list files available for
download from a SourceForge project that I administer.

I am running a version of CURL (and libcurl); 7.22 rebuilt with sftp
support on Ubuntu 12.04 64bit.

*curl -V*

curl 7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1
zlib/ libidn/1.23 libssh2/1.2.8 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3
pop3s rtmp rtsp scp sftp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

My intention is to read the list of files from within a Rexx/CURL
program, but as I was not having any success I tried the same file
listing via the curl command line.
The results of:
*curl -v --key /home/mark/.ssh/id_rsa --pubkey

* About to connect() to port 22 (#0)
* Trying connected
* SSH host check: 0, key:
* SSH authentication methods available:
* Using ssh public key file /home/mark/.ssh/
* Using ssh private key file /home/mark/.ssh/id_rsa
* *SSH public key authentication failed: Callback returned error*
* Authentication failure
* Closing connection #0
curl: (67) Authentication failure

The highlighted error is the same I'm getting from my Rexx/CURL program.

I have no authentication problem with sftp:
*sftp rexx,*

Connected to
sftp> cd /home/frs/project/regina-rexx/regina-rexx
sftp> ls
3.0 3.2
3.3 3.4
3.5 3.6
3.6B1 3.7
3.7RC1 what file to download.html
sftp> exit

I've looked at a couple of other questions on what appears to be a
similar issue with CURL and SFTP, but none of the answers address the
specific issue of what *Callback returned error*.
I don't see any callback that is needed to be called in libcurl. I've
tried with specifying the known hosts file and providing a callback for
that, but from what I read of the documentation, the known hosts option
is not mandatory.

Any help with resolving this would be appreciated.

Cheers, Mark

* Mark Hessling,
* Author of THE, a Free XEDIT/KEDIT editor and, Rexx/SQL, Rexx/CURL, etc.
* Maintainer of Regina Rexx interpreter
* Use Rexx? join the Rexx Language Association:

List admin:
Received on 2013-01-06