Skip to content

curl fails to do password authentication with sftp using libssh backend #23080

Description

@And-yW

I did this

I get this:
curl -v -s -S --connect-timeout 10 --hostpubsha256 "HASH" -u "user:pass" -T /tmp/slask.bin -g sftp://192.168.0.20
2/tmp/

  • SSH: private key file ''
  • Trying 192.168.0.202:22...
  • Established connection to 192.168.0.202 (192.168.0.202 port 22) from 192.168.0.207 port 47726
  • User: user
  • SSH SHA256 fingerprint:
  • SSH authentication methods available: public key, keyboard-interactive, password
  • Authentication using SSH public key file
  • Could not load private key file
  • closing connection #0
    curl: (67) Could not load private key file

I've attached a patch that solves the issue, the problem seems to be that libssh.c only NULL checks sshc->priv_key but its set to "".

0001-libssh-Handle-empty-private-key.patch

I expected the following

That it works.

curl/libcurl version

curl 8.22.0 (aarch64-poky-linux-gnu) libcurl/8.22.0 OpenSSL/3.5.7 zlib/1.3.2 libssh/0.11.5/openssl/zlib
Release-Date: 2026-09-02
Protocols: dict file ftp ftps http https imap imaps ipfs ipns pop3 pop3s rtsp scp sftp smtp smtps tftp ws wss
Features: alt-svc HSTS HTTPS-proxy IPv6 Largefile libz SSL threadsafe UnixSockets

operating system

Linux 5.15.167-rel-5.15-artpec8-951 #1 SMP PREEMPT Thu Sep 10 16:06:46 UTC 2026 aarch64 GNU/Linux

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions