curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder Daniel himself.

Re: curl sftp connection problem

From: toby via curl-users <curl-users_at_lists.haxx.se>
Date: Mon, 16 Mar 2026 11:17:16 -0600

sorry for this confusion the post before this from me it was prepared a few days ago before i did some curl compiling work

it turns out that i had been compiling 8.18.0 with mbedtls instead of openssl and 7,78.9 with openssl and when i recompiled 8.18.0 with openssl instead of mbed it works

the libssh2 version is 1.11.1

> Hi
>
> i have latest libssh2, curl, openssh and oroftpd installed from source
>
> curl -V
> curl 8.18.0 (x86_64-pc-linux-gnu) libcurl/8.18.0 mbedTLS/3.6.5 zlib/1.2.12 libssh2/1.11.1 librtmp/2.3
> Release-Date: 2026-01-07
> Protocols: dict file ftp ftps http https imap imaps ipfs ipns mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps tftp ws wss
> Features: alt-svc AsynchDNS HSTS HTTPS-proxy Largefile libz NTLM SSL threadsafe UnixSockets
>
> the sftp program from openssh works fine connecting to both proftpd (set up for sftp) and sshd
> /usr/local/bin/sftp -v -oPort=212 user_at_server.net
>
> curl to the proftpd also set uo for ftps works fine (proftpd ftps : 21 and sfto : 212)
> /usr/local/bin/curl -v -k -u uwer:pass --ssl-reqd ftp://myserver.net/
>
> i really want to use curl with sftp to connect to either sshd or proftpd instead of using the sftp command
> i get the same error using curl to either sshd or proftpd with this line
>
> /usr/local/bin/curl -v -k -u user sftp://myserver.net:212
> * libssh2 cryptography backend: openssl compatible
> * User: 'user'
> * Failure establishing ssh session: -8, Unable to exchange encryption keys
> * closing connection #0
> curl: (2) Failure establishing ssh session: -8, Unable to exchange encryption keys
>
> this is from th proftpd sftp.log file
> 2026-03-10 16:54:44,027 mod_sftp/1.2.0[7982]: client (xxx.xxx.xx.xxx:52884) connected to server (xxx.xxx.xx.xxx:212)
> 2026-03-10 16:54:44,027 mod_sftp/1.2.0[7982]: sent server version 'SSH-2.0-mod_sftp'
> 2026-03-10 16:54:44,027 mod_sftp/1.2.0[7982]: received client version 'SSH-2.0-libssh2_1.11.1'
> 2026-03-10 16:54:44,027 mod_sftp/1.2.0[7982]: handling connection from SSH2 client 'libssh2_1.11.1'
> 2026-03-10 16:54:44,027 mod_sftp/1.2.0[7982]: + Session key exchange: ecdh-sha2-nistp256
> 2026-03-10 16:54:44,027 mod_sftp/1.2.0[7982]: + Session host key algorithm: rsa-sha2-512
> 2026-03-10 16:54:44,027 mod_sftp/1.2.0[7982]: + Session server hostkey: rsa-sha2-512
> 2026-03-10 16:54:44,027 mod_sftp/1.2.0[7982]: + Session client-to-server encryption: chacha20-poly1305_at_openssh.com
> 2026-03-10 16:54:44,027 mod_sftp/1.2.0[7982]: + Session server-to-client encryption: chacha20-poly1305_at_openssh.com
> 2026-03-10 16:54:44,027 mod_sftp/1.2.0[7982]: + Session client-to-server compression: none
> 2026-03-10 16:54:44,027 mod_sftp/1.2.0[7982]: + Session server-to-client compression: none
> 2026-03-10 16:54:44,027 mod_sftp/1.2.0[7982]: client at xxx.xxx.xx.xxx sent SSH_DISCONNECT message: Shutdown (Application disconnected)
>
> i had a curl encryption problem a long time ago and had to add some new cipher line to a ssh/sshd config file but openssh isn't involved here
> just proftpd
>
> amy place to start would be appreciated
>
> --
> Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
> Etiquette: https://curl.se/mail/etiquette.html
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2026-03-16