1CURLOPT_SSH_KNOWNHOSTS(3) curl_easy_setopt options CURLOPT_SSH_KNOWNHOSTS(3)
2
3
4
6 CURLOPT_SSH_KNOWNHOSTS - file name holding the SSH known hosts
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_KNOWNHOSTS, char
12 *fname);
13
15 Pass a pointer to a zero terminated string holding the file name of the
16 known_host file to use. The known_hosts file should use the OpenSSH
17 file format as supported by libssh2. If this file is specified, libcurl
18 will only accept connections with hosts that are known and present in
19 that file, with a matching public key. Use CURLOPT_SSH_KEYFUNCTION(3)
20 to alter the default behavior on host and key (mis)matching.
21
22 The application does not have to keep the string around after setting
23 this option.
24
26 NULL
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_KNOWNHOSTS,
36 "/home/clarkkent/.ssh/known_hosts");
37 ret = curl_easy_perform(curl);
38 curl_easy_cleanup(curl);
39 }
40
42 Added in 7.19.6
43
45 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
46 not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
47
49 CURLOPT_SSH_AUTH_TYPES(3), CURLOPT_SSH_HOST_PUBLIC_KEY_MD5(3),
50
51
52
53libcurl 7.66.0 May 31, 2017 CURLOPT_SSH_KNOWNHOSTS(3)