CURLOPT_SSH_KNOWNHOSTS.3 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. .\" generated by cd2nroff 0.1 from CURLOPT_SSH_KNOWNHOSTS.md
  2. .TH CURLOPT_SSH_KNOWNHOSTS 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_SSH_KNOWNHOSTS \- filename holding the SSH known hosts
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_KNOWNHOSTS, char *fname);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a pointer to a null\-terminated string holding the filename of the
  12. known_host file to use. The known_hosts file should use the OpenSSH file
  13. format as supported by libssh2. If this file is specified, libcurl only
  14. accepts connections with hosts that are known and present in that file, with a
  15. matching public key. Use \fICURLOPT_SSH_KEYFUNCTION(3)\fP to alter the default
  16. behavior on host and key matches and mismatches.
  17. The application does not have to keep the string around after setting this
  18. option.
  19. .SH DEFAULT
  20. NULL
  21. .SH PROTOCOLS
  22. This functionality affects scp and sftp
  23. .SH EXAMPLE
  24. .nf
  25. int main(void)
  26. {
  27. CURL *curl = curl_easy_init();
  28. if(curl) {
  29. CURLcode res;
  30. curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
  31. curl_easy_setopt(curl, CURLOPT_SSH_KNOWNHOSTS,
  32. "/home/clarkkent/.ssh/known_hosts");
  33. res = curl_easy_perform(curl);
  34. curl_easy_cleanup(curl);
  35. }
  36. }
  37. .fi
  38. .SH AVAILABILITY
  39. Added in curl 7.19.6
  40. .SH RETURN VALUE
  41. Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
  42. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  43. .SH SEE ALSO
  44. .BR CURLOPT_SSH_AUTH_TYPES (3),
  45. .BR CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 (3)