cURL / Mailing Lists / curl-library / Single Mail

curl-library

SFTP public key authentication

From: Mark Hessling <mark_at_rexx.org>
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/1.2.3.4 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
/home/mark/.ssh/id_rsa.pub
sftp://rexx,regina-rexx@frs.sourceforge.net/home/frs/project/regina-rexx/regina-rexx*

* About to connect() to frs.sourceforge.net port 22 (#0)
* Trying 216.34.181.57... connected
* SSH host check: 0, key:
AAAAB3NzaC1yc2EAAAABIwAAAQEA2uifHZbNexw6cXbyg1JnzDitL5VhYs0E65Hk/tLAPmcmm5GuiGeUoI/B0eUSNFsbqzwgwrttjnzKMKiGLN5CWVmlN1IXGGAfLYsQwK6wAu7kYFzkqP4jcwc5Jr9UPRpJdYIK733tSEmzab4qc5Oq8izKQKIaxXNe7FgmL15HjSpatFt9w/ot/CHS78FUAr3j3RwekHCm/jhPeqhlMAgC+jUgNJbFt3DlhDaRMa0NYamVzmX8D47rtmBbEDU3ld6AezWBPUR5Lh7ODOwlfVI58NAf/aYNlmvl2TZiauBCTa7OPYSyXJnIPbQXg6YQlDknNCr0K769EjeIlAfY87Z4tw==
* SSH authentication methods available:
publickey,password,keyboard-interactive
* Using ssh public key file /home/mark/.ssh/id_rsa.pub
* 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,regina-rexx_at_frs.sourceforge.net*

Connected to frs.sourceforge.net.
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
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, mark@rexx.org http://www.rexx.org/
* 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: http://www.rexxla.org/
------------------------------------------------------------------------

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-01-06