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
14Added-in: 7.16.1
15---
16
17# NAME
18
19CURLOPT_SSH_AUTH_TYPES - auth types for SFTP and SCP
20
21# SYNOPSIS
22
23~~~c
24#include <curl/curl.h>
25
26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_AUTH_TYPES, long bitmask);
27~~~
28
29# DESCRIPTION
30
31Pass a long set to a bitmask consisting of one or more of
32CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD, CURLSSH_AUTH_HOST,
33CURLSSH_AUTH_KEYBOARD and CURLSSH_AUTH_AGENT.
34
35Set *CURLSSH_AUTH_ANY* to let libcurl pick a suitable one. Currently
36CURLSSH_AUTH_HOST has no effect. If CURLSSH_AUTH_AGENT is used, libcurl
37attempts to connect to ssh-agent or pageant and let the agent attempt the
38authentication.
39
40# DEFAULT
41
42CURLSSH_AUTH_ANY (all available)
43
44# %PROTOCOLS%
45
46# EXAMPLE
47
48~~~c
49int main(void)
50{
51  CURL *curl = curl_easy_init();
52  if(curl) {
53    CURLcode res;
54    curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
55    curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES,
56                     CURLSSH_AUTH_PUBLICKEY | CURLSSH_AUTH_KEYBOARD);
57    res = curl_easy_perform(curl);
58    curl_easy_cleanup(curl);
59  }
60}
61~~~
62
63# %AVAILABILITY%
64
65# RETURN VALUE
66
67Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
68