CURLOPT_SSH_AUTH_TYPES(3)
π CURLOPT_SSH_AUTH_TYPES(3) β bestie's guide to SFTP/SCP auth
okay so this is page CURLOPT_SSH_AUTH_TYPES(3) from the Library Functions Manual, and it's literally the glow-up your SSH connections needed β¨
πΈ NAME
CURLOPT_SSH_AUTH_TYPES β the auth types you get to use for SFTP and SCP π
π¦ SYNOPSIS
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_AUTH_TYPES, long bitmask);
π DESCRIPTION
bestie, you pass a long here, and it's set to a bitmask β like a little stack of auth vibes you're combining together π«Ά β made of one or more of these:
CURLSSH_AUTH_PUBLICKEYCURLSSH_AUTH_PASSWORDCURLSSH_AUTH_HOSTCURLSSH_AUTH_KEYBOARDCURLSSH_AUTH_AGENT
You can also set CURLSSH_AUTH_ANY to let libcurl pick a suitable one, like "you choose for me, king" π.
and now the messy parts, no cap:
- Currently
CURLSSH_AUTH_HOSThas no effect. it's giving decorative. π - If
CURLSSH_AUTH_AGENTis used, libcurl attempts to connect tossh-agentorpageantand lets the agent attempt the authentication. agent energy, main character stuff π§
β DEFAULT
CURLSSH_AUTH_ANY (all available) β literally all of them, she's generous π
π₯ PROTOCOLS
This functionality affects scp and sftp π
β¨ 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);
}
}
look at her go, combining CURLSSH_AUTH_PUBLICKEY and CURLSSH_AUTH_KEYBOARD with a | like an absolute icon π
π°οΈ HISTORY
okay history lesson time, sit down π β the CURLSSH_AUTH_* macros became long types in 8.16.0. Prior to that version, a long cast was necessary when passed to curl_easy_setopt(3). so glow-up era, basically β¨
π£ AVAILABILITY
Added in curl 7.16.1 β vintage but still slaying π
π« RETURN VALUE
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).
π SEE ALSO
CURLOPT_SSH_HOST_PUBLIC_KEY_MD5(3)CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256(3)CURLOPT_SSH_PUBLIC_KEYFILE(3)
the friend group fr fr π«Ά
π reminder bestie: CURLSSH_AUTH_HOST currently does nothing. don't be out here expecting it to work, iykyk.
that's the whole page, mwah π β brought to you by libcurl, dated 2026-10-12, and filed under CURLOPT_SSH_AUTH_TYPES(3). go forth and authenticate, queen ππ
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms