GNURLOPT_SSH_AUTH_TYPES(3)
π GNURLOPT_SSH_AUTH_TYPES(3)
okay bestie, so this one lives in the curl_easy_setopt options section of the manual (yes, the gnurl-flavored one, we're fancy like that) β and it's literally all about telling SFTP and SCP how you wanna prove who you are. let's get into it π«Ά
β¨ NAME β¨
CURLOPT_SSH_AUTH_TYPES β set desired auth types for SFTP and SCP
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_AUTH_TYPES, long
bitmask);
β¨ DESCRIPTION β¨
so you pass a long that's set to a bitmask (iykyk, it's giving "OR a bunch of flags together"), and that bitmask is made of one or more of these icons π:
CURLSSH_AUTH_PUBLICKEYCURLSSH_AUTH_PASSWORDCURLSSH_AUTH_HOSTCURLSSH_AUTH_KEYBOARDCURLSSH_AUTH_AGENT
if you'd rather not choose, set CURLSSH_AUTH_ANY and let libcurl pick a suitable one for you β main character energy, let the library decide π
ngl, one thing to know: currently CURLSSH_AUTH_HOST has no effect. it's just kinda there, vibing π¦
and if you use CURLSSH_AUTH_AGENT, libcurl attempts to connect to ssh-agent or pageant and lets the agent attempt the authentication. teamwork, slay π
β¨ DEFAULT β¨
None π (no default, you gotta tell it what you want)
β¨ PROTOCOLS β¨
SFTP and SCP πΈ
β¨ EXAMPLE β¨
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "sftp://example.com/file");
curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES,
CURLSSH_AUTH_PUBLICKEY | CURLSSH_AUTH_KEYBOARD);
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
look at that bitmask going off β CURLSSH_AUTH_PUBLICKEY | CURLSSH_AUTH_KEYBOARD, iconic combo π₯
β¨ AVAILABILITY β¨
CURLSSH_AUTH_HOSTwas added in 7.16.1CURLSSH_AUTH_AGENTwas added in 7.28.0
β¨ RETURN VALUE β¨
returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. that's it, that's the vibe check β
β¨ SEE ALSO β¨
bestie reminder: CURLSSH_AUTH_HOST is currently a no-op, so don't build your whole personality around it π
mwah, that's the whole page π β brought to you by libcurl 7.37.0, dated 19 Jun 2014, filed under GNURLOPT_SSH_AUTH_TYPES(3). go forth and auth, queen ππ
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms