1CURLOPT_SSH_KNOWNHOSTS(3)  curl_easy_setopt options  CURLOPT_SSH_KNOWNHOSTS(3)
2
3
4

NAME

6       CURLOPT_SSH_KNOWNHOSTS - file name holding the SSH known hosts
7

SYNOPSIS

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

DESCRIPTION

14       Pass a pointer to a null-terminated string holding the file name of the
15       known_host file to use.  The known_hosts file should  use  the  OpenSSH
16       file format as supported by libssh2. If this file is specified, libcurl
17       will only accept connections with hosts that are known and  present  in
18       that  file,  with a matching public key. Use CURLOPT_SSH_KEYFUNCTION(3)
19       to alter the default behavior on host and key (mis)matching.
20
21       The application does not have to keep the string around  after  setting
22       this option.
23

DEFAULT

25       NULL
26

PROTOCOLS

28       SFTP and SCP
29

EXAMPLE

31       CURL *curl = curl_easy_init();
32       if(curl) {
33         curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
34         curl_easy_setopt(curl, CURLOPT_SSH_KNOWNHOSTS,
35                          "/home/clarkkent/.ssh/known_hosts");
36         ret = curl_easy_perform(curl);
37         curl_easy_cleanup(curl);
38       }
39

AVAILABILITY

41       Added in 7.19.6
42

RETURN VALUE

44       Returns  CURLE_OK  if  the option is supported, CURLE_UNKNOWN_OPTION if
45       not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
46

SEE ALSO

48       CURLOPT_SSH_AUTH_TYPES(3), CURLOPT_SSH_HOST_PUBLIC_KEY_MD5(3),
49
50
51
52libcurl 7.82.0                 November 26, 2021     CURLOPT_SSH_KNOWNHOSTS(3)
Impressum