1CURLOPT_SSH_PUBLIC_KEYFILE(3c)url_easy_setopt optionCsURLOPT_SSH_PUBLIC_KEYFILE(3)
2
3
4

NAME

6       CURLOPT_SSH_PUBLIC_KEYFILE - set public key file for SSH auth
7

SYNOPSIS

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

DESCRIPTION

15       Pass  a char * pointing to a filename for your public key. If not used,
16       libcurl defaults to $HOME/.ssh/id_dsa.pub if the HOME environment vari‐
17       able  is set, and just "id_dsa.pub" in the current directory if HOME is
18       not set.
19
20       If NULL (or an empty string) is passed, libcurl will pass no public key
21       to  libssh2, which then tries to compute it from the private key.  This
22       is known to work with libssh2 1.4.0+ linked against OpenSSL.
23
24       The application does not have to keep the string around  after  setting
25       this option.
26

DEFAULT

28       NULL
29

PROTOCOLS

31       SFTP and SCP
32

EXAMPLE

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

AVAILABILITY

44       The "" trick was added in 7.26.0
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_PRIVATE_KEYFILE(3), CURLOPT_SSH_AUTH_TYPES(3),
52
53
54
55libcurl 7.76.1                 November 04, 2020 CURLOPT_SSH_PUBLIC_KEYFILE(3)
Impressum