Libcurl SFTP initialize error

Hi all,
I must use SFTP (SSH) to send one file in a server. With Filezilla all are OK. But with libcurl I have ‘Failed initialization’ error and I don’t know how can I fix it. All the parameters are OK and wiht Filezilla I can send the file correct. Can anyone help me?

Thanks in advance!
Michael Diamantidis
Vision Computer Applications
Greece

See in DebugView what happens.

1 Like

Hello Mike and thank you for your help.
The error that I have is : TEXT: SSH public key authentication failed: Unable to extract public key from private key file: Unable to open private key file
But I don’t have any “public key”.
Thanks in advance!

Play with settings on SSH tab, usually “Any” is good choice.

Already I do that and the error still remains.
Also I have a compile error : Unknown identifier: SSH:PUBLICKEYMD5.

LOG:
Reset: Curl Reset
SSHAuth: Set
SetOpt (Port): Set
SetOpt (Usr/Pwd): Set
SetOpt (Timeout): Set
Build URL: sftp://[email protected]
Trailing /: sftp://[email protected]/
Append Remote Dir: sftp://[email protected]//home/visioncagr/www/Downloads
Trailing /: sftp://[email protected]//home/visioncagr/www/Downloads/
Build Remote File Name: sftp://[email protected]//home/visioncagr/www/Downloads/soft1_Test.json
File Size: 4103743
Upload Started: 8:04 ìì
TEXT: Trying 185.51.135.119:22…
TEXT: TCP_NODELAY set
TEXT: Connected to m02.fastpath.gr (185.51.135.119) port 22 (#0)
TEXT: SSH MD5 fingerprint: a08cc17516aef28113349269596b33cf
TEXT: SSH authentication methods available: publickey,password,keyboard-interactive
TEXT: Using SSH private key file ‘’
TEXT: SSH public key authentication failed: Unable to extract public key from private key file: Unable to open private key file
TEXT: Initialized password authentication
TEXT: Authentication complete
TEXT: Failure initializing sftp session: Unable to request SFTP subsystem
TEXT: Closing connection 0
Upload Finished: 8:04 ìì
File Upload: Upload failed

Thanks in advance!

1 Like

PublicKeyMD5 field was introduced in v1.37, current is 1.48.

Regarding “Failure initializing sftp session: Unable to request SFTP subsystem” error - never seen this before, google forwards to libssh2 library, which is used by libcurl, so maybe recent builds fix this issue.

1 Like

Thank you Mike for your help. I have the latest realease 1.48. So I must be wait for a new release?

I found similar question here, not related to curl though, and with no reasonable answer.
Another similar thread. What I think is sftp server configuration is not correct. FileZilla knows how to bypass this, curl doesn’t.

I don’t think so. libssh2 just reports that something goes wrong on server side.

1 Like

Look at FileZilla log, if it has something like this

2013-05-07 08:16:15 2704 3 Traza: Opened channel for session
2013-05-07 08:16:15 2704 3 Traza: Primary command failed; attempting fallback

then something wrong on the server.

1 Like

My Host Provider solve the problem and the file is uploaded with success. Thanks again!

I have same problem and not sure why…