CURLOPT_NEW_FILE_PERMS(3)
π CURLOPT_NEW_FILE_PERMS β¨
bestie, literally welcome to the CURLOPT_NEW_FILE_PERMS page, straight out of the Library Functions Manual π ok so pull up a chair, we're talking permissions today and it's gonna be iconic.
πΈ NAME πΈ
CURLOPT_NEW_FILE_PERMS β the permissions for files you create remotely, no cap π₯
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_FILE_PERMS,
long mode);
π¦ DESCRIPTION π¦
okay so you pass a long as the parameter, and that value is literally the permissions that get set on newly created files on the remote server. that's it, that's the whole vibe π
the default value is 0644, which is giving sensible-and-chill.
the only protocols that can use this are sftp://, scp://, and file:// β everyone else can sit this one out, iykyk π
π DEFAULT π
0644
π PROTOCOLS π
this functionality affects file, scp and sftp π«Ά
π EXAMPLE π
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "sftp://upload.example.com/file.txt");
curl_easy_setopt(curl, CURLOPT_NEW_FILE_PERMS, 0664L);
result = curl_easy_perform(curl);
}
}
look at her go πβ¨ setting 0664L before the upload, main character energy fr fr.
β AVAILABILITY β
added in curl 7.16.4 β vintage but still slaying π
π 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, so go check libcurl-errors(3) to find out what went wrong π
π SEE ALSO π
and that's the whole page bestie, go forth and chmod your remote uploads π
this has been libcurl, dated 2026-10-12 β CURLOPT_NEW_FILE_PERMS(3), signing off π§β¨π¦
π¦ 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