cURL / Mailing Lists / curl-users / Single Mail

curl-users

Error with cURL Command-Line while SSH SFTP Upload

From: SOLOT Olivier <Olivier.SOLOT_at_touring.be>
Date: Wed, 15 Sep 2010 10:23:47 +0200

Hello everyone,
We are trying to use the swiss-knife cURL in a batch to upload file using SFTP (so with SSH) in windows environment.
We knows that we have the correct URL, Login and password since with other SFTP client (Total Commander + SFTP plugin or psftp.exe) it works correctly.
SSH libraries are stored in the cURL directory, and cURL is the last version with SSH enabled.

We use the next command-line:
        curl.exe -v -k --hostpubmd5 <ssh-rsa 32bytes key> -T file.xml sftp://<sftpsite>/<homedirectory> -u <username>:<password>

where <ssh-rsa 32bytes key>,<sftpsite>,<homedirectory>,<username>,<password> are replaced with real exact values, of course.

We get the next result (sensitive values have been replace for security):

        * About to connect() to [ftpsite] port 22 (#0)
        * Trying xxx.xxx.xxx.xxx... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
          0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0connected
        * Connected to <sftpsite> (xxx.xxx.xxx.xxx) port 22 (#0)
          0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0*
        SSH authentication methods available: publickey,gssapi-with-mic,password
        * Using ssh public key file id_dsa.pub
        * Using ssh private key file id_dsa
        * SSH public key authentication failed: Unable to open public key file
        * Initialized password authentication
        * Authentication complete
          0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0*
        Upload failed: Operation failed (4/-31)
          0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0*
        Connection #0 to host <sftpsite> left intact

        curl: (79) Upload failed: Operation failed (4/-31)
          0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0*
        Closing connection #0

Could you, please, tell me what's wrong when i get the error 79 "curl: (79) Upload failed: Operation failed (4/-31)"
What does mean the "(4/-31)"
And what should I do to don't have this error ?

I've got the ssh-rsa key / fingerprint of the remote sftp server, but i'm not sure it's correctly used in the command line and if it's required since it seems that the authenticaion is complete and the error seems to come when uploading or maybe when it change remote directory. About the ssh-rsa key, can you precise what the syntax of the key should be used (00112233445566778899AABBCCDDEEFF or 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF ... or something else, at this time the first is form is used)
I've already tested to just provide the sftpsite without the remote directory but there it fails with an access denied, so i guess that providing the full path is correct.

Your help or advices would be very valuable.
Thank You
Olivier

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-09-15