Error executing sftp with curl

3

I'm using IBM's Data Explorer to import certain data, but am getting this error:

Protocol sftp not supported or disabled in libcurl.

So from Red Hat I manually ran the command:

curl -user sftp://hostname.com/~/filename.csv

But got this error:

curl: (51) SSL peer certificate or SSH remote key was not OK

To see if SFTP is supported I ran curl -V and got following:

curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp

Does anyone know what could be wrong? Thanks.

codebee

Posted 2015-01-01T22:24:55.130

Reputation: 133

Looks like you key is bad. However there is a remote chance that if this worked previously, the server you are attempting to connect to is having a problem. – mdpc – 2015-01-01T22:26:19.487

I've never had it work. How do I make this key good (I'm not even sure which key)? Thanks. – codebee – 2015-01-01T22:27:34.500

Answers

3

IBM Data Explorer is probably linked against its own private copy of libcurl, so what you see in the system version may not be reflective of the IBM version as far as sftp support.

Normally, curl works like this:

curl -u <username> sftp://hostname.com/~/filename.csv

This assumes you have successfully run ssh hostname.com before, which should have added the right key entry to your ~/.ssh/known_hosts file. If for some reason this is problematic, you could add -k to the curl command line to disable the SSH host key check.

jjlin

Posted 2015-01-01T22:24:55.130

Reputation: 12 964