curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. 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 himself.

Unable to do password based SCP

From: radiatejava via curl-library <curl-library_at_lists.haxx.se>
Date: Fri, 28 Apr 2023 13:13:59 -0700

I am using libcurl 7.56.1 built with OpenSSL 1.1.1 and libssh2 1.10.
When I try to do scp of a file using password option set in the curl
code, libcurl continues to attempt key based ssh/scp using a
non-existing private key file first that obviously fails. Debug
options with curl prints this:

Debug details: SSH authentication methods available: publickey,password
Debug details: Using SSH private key file ''
Debug details: SSH public key authentication failed: Unable to extract
public key from private key file: Unable to open private key file
Debug details: Authentication failure
Debug details: Closing connection 0
ErrorCode=67, ErrorStr=Login denied

This is my curl code. What could be the problem here?

if ( CURLE_OK == (lCode = curl_easy_setopt(client,
CURLOPT_ERRORBUFFER, curlErrStr))
&& CURLE_OK == (lCode = curl_easy_setopt(client,
CURLOPT_PROTOCOLS, lCurlProtocol))
&& CURLE_OK == (lCode = curl_easy_setopt(client,
CURLOPT_PORT, remotePort))
&& CURLE_OK == (lCode = curl_easy_setopt(client,
CURLOPT_URL, lUrl.getBuffer()))
&& CURLE_OK == (lCode = curl_easy_setopt(client,
CURLOPT_NOPROGRESS, 1L))
&& CURLE_OK == (lCode = curl_easy_setopt(client,
CURLOPT_NOSIGNAL, 1L))
&& CURLE_OK == (lCode = curl_easy_setopt(client,
CURLOPT_FOLLOWLOCATION, 1L))
&& CURLE_OK == (lCode = curl_easy_setopt(client,
CURLOPT_SSL_VERIFYHOST, 0L))
&& CURLE_OK == (lCode = curl_easy_setopt(client,
CURLOPT_SSL_VERIFYPEER, 0L))
&& CURLE_OK == (lCode = curl_easy_setopt(client,
CURLOPT_DNS_CACHE_TIMEOUT, 0L))
&& CURLE_OK == (lCode = curl_easy_setopt(client,
CURLOPT_CONNECTTIMEOUT, 30))
&& CURLE_OK == (lCode = curl_easy_setopt(client,
CURLOPT_TIMEOUT, transferTimeoutSec))
)
{
if (CURLE_OK == (lCode = curl_easy_setopt(client, CURLOPT_USERNAME,
username.getBuffer())))
{
if ((( CURLE_OK != (lCode = curl_easy_setopt(client,
CURLOPT_SSH_AUTH_TYPES, CURLSSH_AUTH_PASSWORD|CURLSSH_AUTH_KEYBOARD))
|| CURLE_OK != (lCode = curl_easy_setopt(client, CURLOPT_PASSWORD,
password.getBuffer())))))
{
return false;
}
}
else
{
return false;
}
return true;
}
}
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-04-28