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

Reply via email to