curl / Mailing Lists / curl-library / Single Mail

curl-library

Help Needed Debugging Authentication Failure

From: Stephen McRoberts via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 30 May 2017 10:37:04 -0400

Supporting information below but question:
         How can I simulate the "-k" option in libcurl? Any idea why authentication fails?

-- Details --
Running on MacOS 10.12.5
Installed libssh2 using brew
Downloaded curl-7.54.0
---cd curl-7.54.0
---./configure --with-libssh2=/usr/local
---make
---sudo make install

Downloaded sftpget.c as test and added this:
 char* nameenc = curl_easy_escape(curl, NAME, 0);
 char* passenc = curl_easy_escape(curl, PASS, 0);
 curl_easy_setopt(curl, CURLOPT_URL, "sftp://raspberrypi.local/~/test.txt");
 curl_easy_setopt(curl, CURLOPT_USERNAME, nameenc);
 curl_easy_setopt(curl, CURLOPT_PASSWORD, passenc);

But I get this (truncated):
  SSH authentication methods available: publickey,password
  No identity would match
  Authentication failure
  curl told us 67

I tried the same thing with cURL:
  curl -k "sftp://raspberrypi.local/~/test.txt" --user "NAME:PASS" -o "/Users/steve/Downloads/test.txt"
and it worked fine. Although, omitting the "-k" option failed with:
  curl: (51) SSL peer certificate or SSH remote key was not OK

Note that I normally use public/private key to login to raspberrypi.local without password and that works fine.

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-05-30