cURL / Mailing Lists / curl-users / Single Mail

curl-users

SFTP example

From: Shehryar Khan <khans_at_ubermind.com>
Date: Wed, 14 Feb 2007 11:53:05 -0800

I'm looking to add SFTP support to my Objective-C / Cocoa program
using libcurl and I thought I'd get it working using the command line
first to get a feel for what the curl opts would be.

I'm on Mac OS X 10.4.8 and using the version of curl that came
bundled with the OS.

khans$ curl --version
curl 7.13.1 (powerpc-apple-darwin8.0) libcurl/7.13.1 OpenSSL/0.9.7l
zlib/1.2.3
Protocols: ftp gopher telnet dict ldap http file https ftps
Features: IPv6 Largefile NTLM SSL libz

connecting to an FTP server using curl works flawlessly

khans$ curl -u khans:<snipped> ftp://192.168.0.4

however connecting to the same host using SFTP doesn't work

khans$ curl -u khans:<snipped> sftp://192.168.0.4
curl: (1) Unsupported protocol: sftp

khans$ curl -u khans:<snipped> ftps://192.168.0.4
curl: (7) couldn't connect to host

khans$ curl -v -u khans:<snipped> ftps://192.168.0.4
* About to connect() to 192.168.0.4 port 990
* Trying 192.168.0.4... * Connection refused
* couldn't connect to host
* Closing connection #0
curl: (7) couldn't connect to host

khans$ curl -v -u khans:<snipped> ftps://192.168.0.4:22
* About to connect() to 192.168.0.4 port 22
* Trying 192.168.0.4... * connected
* Connected to 192.168.0.4 (192.168.0.4) port 22
* successfully set certificate verify locations:
* CAfile: /usr/share/curl/curl-ca-bundle.crt
   CApath: none
* error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
* Closing connection #0
curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown
protocol

khans$ curl -v -2 -u khans:\$up3r\:NG ftps://192.168.0.4:22
* About to connect() to 192.168.0.4 port 22
* Trying 192.168.0.4... * connected
* Connected to 192.168.0.4 (192.168.0.4) port 22
* successfully set certificate verify locations:
* CAfile: /usr/share/curl/curl-ca-bundle.crt
   CApath: none

<hangs>

What am I missing here?

thanks!

-shehryar
Received on 2007-02-14