1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_SSH_AUTH_TYPES
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 (3)
9  - CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 (3)
10  - CURLOPT_SSH_PUBLIC_KEYFILE (3)
11Protocol:
12  - SFTP
13  - SCP
14---
15
16# NAME
17
18CURLOPT_SSH_AUTH_TYPES - auth types for SFTP and SCP
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_AUTH_TYPES, long bitmask);
26~~~
27
28# DESCRIPTION
29
30Pass a long set to a bitmask consisting of one or more of
31CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD, CURLSSH_AUTH_HOST,
32CURLSSH_AUTH_KEYBOARD and CURLSSH_AUTH_AGENT.
33
34Set *CURLSSH_AUTH_ANY* to let libcurl pick a suitable one. Currently
35CURLSSH_AUTH_HOST has no effect. If CURLSSH_AUTH_AGENT is used, libcurl
36attempts to connect to ssh-agent or pageant and let the agent attempt the
37authentication.
38
39# DEFAULT
40
41CURLSSH_AUTH_ANY (all available)
42
43# EXAMPLE
44
45~~~c
46int main(void)
47{
48  CURL *curl = curl_easy_init();
49  if(curl) {
50    CURLcode res;
51    curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
52    curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES,
53                     CURLSSH_AUTH_PUBLICKEY | CURLSSH_AUTH_KEYBOARD);
54    res = curl_easy_perform(curl);
55    curl_easy_cleanup(curl);
56  }
57}
58~~~
59
60# AVAILABILITY
61
62CURLSSH_AUTH_HOST was added in 7.16.1, CURLSSH_AUTH_AGENT was added in 7.28.0
63
64# RETURN VALUE
65
66Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
67