1CURLOPT_SSH_PRIVATE_KEYFILE(c3u)rl_easy_setopt optioCnUsRLOPT_SSH_PRIVATE_KEYFILE(3)
2
3
4
6 CURLOPT_SSH_PRIVATE_KEYFILE - private key file for SSH auth
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_PRIVATE_KEYFILE,
12 char *filename);
13
15 Pass a char * pointing to a filename for your private key. If not used,
16 libcurl defaults to $HOME/.ssh/id_dsa if the HOME environment variable
17 is set, and just "id_dsa" in the current directory if HOME is not set.
18
19 If the file is password-protected, set the password with CURLOPT_KEY‐
20 PASSWD(3).
21
22 The application does not have to keep the string around after setting
23 this option.
24
26 As explained above
27
29 SFTP and SCP
30
32 CURL *curl = curl_easy_init();
33 if(curl) {
34 curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
35 curl_easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE,
36 "/home/clarkkent/.ssh/id_rsa");
37 curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "password");
38 ret = curl_easy_perform(curl);
39 curl_easy_cleanup(curl);
40 }
41
43 Added in 7.16.1
44
46 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
47 not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
48
50 CURLOPT_SSH_PUBLIC_KEYFILE(3), CURLOPT_SSH_AUTH_TYPES(3),
51
52
53
54libcurl 7.82.0 September 08, 2021CURLOPT_SSH_PRIVATE_KEYFILE(3)