1

I am trying to use curl to connect to an SFTP server. The server only accepts password authentication. When I try to connect, curl only attempts public-key auth.

$ curl --verbose --insecure 'sftp://exampleuser:examplepass@sftp.example.com:2020/test.txt'
*   Trying 100.100.70.70:2020...
* TCP_NODELAY set
* Connected to sftp.example.com (100.100.70.70) port 2020 (#0)
* User: exampleuser
* Authentication using SSH public key file
* Authentication failure
* Closing connection 0
curl: (67) Authentication failure

I have tried many things to force it to use password auth, such as:

$ curl --verbose --insecure --user 'exampleuser:examplepass' --key '' --pubkey '' 'sftp://sftp.example.com:2020/test.txt'
*   Trying 100.100.70.70:2020...
* TCP_NODELAY set
* Connected to sftp.example.com (100.100.70.70) port 2020 (#0)
* User: exampleuser
* Known hosts: /home/example/.ssh/known_hosts
* Could not load public key file
* Authentication using SSH public key file
* Could not load private key file
* Closing connection 0
curl: (67) Could not load public key file

I do know that the username and password work. I can successfully use sftp to connect to the server.

I find it strange that curl is not printing out any message about SSH authentication methods, which I have seen elsewhere. Maybe this is a clue?

SSH authentication methods available: password,publickey

Is there any way to get curl to work in my situation? Or diagnose why it doesn't attempt password auth?

I am running Ubuntu 20.04.5 LTS, with curl 7.68.0-1, libssh-4 0.9.3-2, and libssl1.1 1.1.1f-1.

sourcenouveau
  • 499
  • 1
  • 5
  • 18

0 Answers0