CURLOPT_FTP_ALTERNATIVE_TO_USER(3)

πŸ’… CURLOPT_FTP_ALTERNATIVE_TO_USER(3) ✨

okay so this is a page from the Library Functions Manual (libcurl girlies rise up 🫢) and it's about one specific little curl knob. buckle up bestie, it's short but it eats.


🌸 NAME 🌸

CURLOPT_FTP_ALTERNATIVE_TO_USER β€” the command to use instead of USER with FTP πŸ’–


✨ SYNOPSIS ✨

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_ALTERNATIVE_TO_USER,
                          char *cmd);

πŸŽ€ DESCRIPTION πŸŽ€

so you pass a char pointer as the parameter, and it points at a string. that string gets used to authenticate if the usual FTP "USER user" and "PASS password" negotiation fails 😭 like, the normal handshake didn't slay, so this is the backup plan.

and ngl, this is currently only known to be required when you're connecting to Tumbleweed's Secure Transport FTPS server, using client certificates for auth. that's the one iconic scenario where this thing shows up. πŸ¦‹

the application does not have to keep the string around after setting this option β€” lowkey the nicest part, no memory management drama, we love that for you πŸ’…


⭐ DEFAULT ⭐

NULL

literally nothing, no default command, it's giving empty. πŸ™ˆ


🌈 PROTOCOLS 🌈

this functionality affects ftp only β€” ftp girlies only, everyone else can go home 🧚


πŸ’œ EXAMPLE πŸ’œ

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
    curl_easy_setopt(curl, CURLOPT_FTP_ALTERNATIVE_TO_USER, "two users");
    result = curl_easy_perform(curl);

    curl_easy_cleanup(curl);
  }
}

look at her go 😭 "two users" as the alternative command, main character energy fr fr.


πŸ¦‹ AVAILABILITY πŸ¦‹

added in curl 7.15.5 β€” vintage but still valid, iykyk πŸ‘‘


πŸ”₯ RETURN VALUE πŸ”₯

curl_easy_setopt(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK 😌✨ and non-zero means an error occurred bestie, sorry β€” see libcurl-errors(3) for the full breakdown.


πŸ’€ SEE ALSO πŸ’€


reminder bestie: that default is NULL, so if you don't set this, nothing gets passed. no cap, no fallback command, just vibes. πŸŽ€

okay that's the page!! signed off with love from the libcurl girlies, dated 2026-10-12, straight out of the libcurl release notes πŸ’–πŸ«Άβœ¨ periodt.

πŸ“¦ where this page comes from