1CURLOPT_SSH_PRIVATE_KEYFILE(3)      libcurl     CURLOPT_SSH_PRIVATE_KEYFILE(3)
2
3
4

NAME

6       CURLOPT_SSH_PRIVATE_KEYFILE - private key file for SSH auth
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_PRIVATE_KEYFILE,
12                                 char *filename);
13

DESCRIPTION

15       Pass a char * pointing to a filename for your private key. If not used,
16       libcurl defaults to $HOME/.ssh/id_rsa or $HOME/.ssh/id_dsa if the  HOME
17       environment  variable is set, and just "id_rsa" or "id_dsa" in the cur‐
18       rent directory if HOME is not set.
19
20       If the file is password-protected, set the password  with  CURLOPT_KEY‐
21       PASSWD(3).
22
23       The  application  does not have to keep the string around after setting
24       this option.
25

DEFAULT

27       As explained above
28

PROTOCOLS

30       SFTP and SCP
31

EXAMPLE

33       CURL *curl = curl_easy_init();
34       if(curl) {
35         curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
36         curl_easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE,
37                          "/home/clarkkent/.ssh/id_rsa");
38         curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "password");
39         ret = curl_easy_perform(curl);
40         curl_easy_cleanup(curl);
41       }
42

AVAILABILITY

44       Added in 7.16.1
45

RETURN VALUE

47       Returns CURLE_OK if the option is  supported,  CURLE_UNKNOWN_OPTION  if
48       not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
49

SEE ALSO

51       CURLOPT_SSH_PUBLIC_KEYFILE(3), CURLOPT_SSH_AUTH_TYPES(3),
52
53
54
55ibcurl 8.2.1                     June 09, 2023  CURLOPT_SSH_PRIVATE_KEYFILE(3)
Impressum