CURLOPT\_SSH\_AUTH\_TYPES(3) Library Functions Manual CURLOPT\_SSH\_AUTH\_TYPES(3)

# [NAME](#NAME)

CURLOPT\_SSH\_AUTH\_TYPES - auth types for SFTP and SCP

# [SYNOPSIS](#SYNOPSIS)

```
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_AUTH_TYPES, long bitmask);
```

# [DESCRIPTION](#DESCRIPTION)

Pass a long set to a bitmask consisting of one or more of CURLSSH\_AUTH\_PUBLICKEY, CURLSSH\_AUTH\_PASSWORD, CURLSSH\_AUTH\_HOST, CURLSSH\_AUTH\_KEYBOARD and CURLSSH\_AUTH\_AGENT.

Set *CURLSSH\_AUTH\_ANY* to let libcurl pick a suitable one. Currently CURLSSH\_AUTH\_HOST has no effect. If CURLSSH\_AUTH\_AGENT is used, libcurl attempts to connect to ssh-agent or pageant and let the agent attempt the authentication.

# [DEFAULT](#DEFAULT)

CURLSSH\_AUTH\_ANY (all available)

# [PROTOCOLS](#PROTOCOLS)

This functionality affects scp and sftp

# [EXAMPLE](#EXAMPLE)

```
int main(void)
{


  CURL *curl = curl_easy_init();


  if(curl) {


    CURLcode result;


    curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");


    curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES,


                     CURLSSH_AUTH_PUBLICKEY | CURLSSH_AUTH_KEYBOARD);


    result = curl_easy_perform(curl);


    curl_easy_cleanup(curl);


  }
}
```

# [HISTORY](#HISTORY)

**CURLSSH\_AUTH\_*** macros became *long* types in 8.16.0, prior to this version a *long* cast was necessary when passed to [*curl\_easy\_setopt(3)*](/man/os/curl/curl_easy_setopt.3).

# [AVAILABILITY](#AVAILABILITY)

Added in curl 7.16.1

# [RETURN VALUE](#RETURN_VALUE)

[*curl\_easy\_setopt(3)*](/man/os/curl/curl_easy_setopt.3) returns a CURLcode indicating success or error.

CURLE\_OK (0) means everything was OK, non-zero means an error occurred, see [*libcurl-errors(3)*](/man/os/curl/libcurl-errors.3).

# [SEE ALSO](#SEE_ALSO)

[**CURLOPT\_SSH\_HOST\_PUBLIC\_KEY\_MD5**(3)](/man/os/curl/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.3), [**CURLOPT\_SSH\_HOST\_PUBLIC\_KEY\_SHA256**(3)](/man/os/curl/CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256.3), [**CURLOPT\_SSH\_PUBLIC\_KEYFILE**(3)](/man/os/curl/CURLOPT_SSH_PUBLIC_KEYFILE.3)

2026-10-31 libcurl

---

Document: CURLOPT_SSH_AUTH_TYPES(3) from curl 8.23.0-r3 (Chainguard OS)
Source: https://github.com/curl/curl.git
