CURLOPT_SSH_PUBLIC_KEYFILE.3 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. .\" generated by cd2nroff 0.1 from CURLOPT_SSH_PUBLIC_KEYFILE.md
  2. .TH CURLOPT_SSH_PUBLIC_KEYFILE 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_SSH_PUBLIC_KEYFILE \- public key file for SSH auth
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_PUBLIC_KEYFILE,
  9. char *filename);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a char pointer pointing to a \fIfilename\fP for your public key. If not used,
  13. libcurl defaults to \fB$HOME/.ssh/id_dsa.pub\fP if the HOME environment variable
  14. is set, and just "id_dsa.pub" in the current directory if HOME is not set.
  15. If NULL (or an empty string) is passed to this option, libcurl passes no
  16. public key to the SSH library, which then rather derives it from the private
  17. key. If the SSH library cannot derive the public key from the private one and
  18. no public one is provided, the transfer fails.
  19. The application does not have to keep the string around after setting this
  20. option.
  21. .SH DEFAULT
  22. NULL
  23. .SH PROTOCOLS
  24. This functionality affects scp and sftp
  25. .SH EXAMPLE
  26. .nf
  27. int main(void)
  28. {
  29. CURL *curl = curl_easy_init();
  30. if(curl) {
  31. CURLcode res;
  32. curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
  33. curl_easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE,
  34. "/home/clarkkent/.ssh/id_rsa.pub");
  35. res = curl_easy_perform(curl);
  36. curl_easy_cleanup(curl);
  37. }
  38. }
  39. .fi
  40. .SH HISTORY
  41. The "" trick was added in 7.26.0
  42. .SH AVAILABILITY
  43. Added in curl 7.16.1
  44. .SH RETURN VALUE
  45. Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
  46. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  47. .SH SEE ALSO
  48. .BR CURLOPT_SSH_AUTH_TYPES (3),
  49. .BR CURLOPT_SSH_PRIVATE_KEYFILE (3)