GNURLOPT_N...TORY_PERMS(3)
π
GNURLOPT_N...TORY_PERMS(3) β your girl's guide to CURLOPT_NEW_DIRECTORY_PERMS
okay so this page lives in the curl_easy_setopt options section of the manual, and it's literally all about what permissions your freshly-made remote directories get. buckle up bestie, it's a short one but it's important π
β¨ NAME β¨
CURLOPT_NEW_DIRECTORY_PERMS β the permissions for directories you create on the remote side π
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_DIRECTORY_PERMS,
long mode);
πΈ DESCRIPTION πΈ
So you pass a long as the parameter, and that value is the permissions that get assigned to directories that are newly created on the remote server. like, brand new dirs, fresh out the box π¦
The default value is 0755, but honestly any valid value can be used β you do you, boo.
The only protocols that can use this are sftp://, scp://, and file://. that's the whole guest list, no plus-ones π
π DEFAULT π
0755
π PROTOCOLS π
SFTP, SCP and FILE
π₯ EXAMPLE π₯
okay so here's the vibe in code form:
CURL *curl = curl_easy_init();
if(curl) {
CURLcode ret;
curl_easy_setopt(curl, CURLOPT_URL, "sftp://upload.example.com/newdir/file.zip");
curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L);
curl_easy_setopt(curl, CURLOPT_NEW_DIRECTORY_PERMS, 0644L);
ret = curl_easy_perform(curl);
}
β AVAILABILITY β
Added in 7.16.4 β she's been iconic for a minute π
π RETURN VALUE π
- Returns
CURLE_OKif the option is supported π«Ά - Returns
CURLE_UNKNOWN_OPTIONif it's not π
π¦ SEE ALSO π¦
ngl bestie, don't sleep on the difference between directory perms and file perms β they're two separate settings and they both matter, iykyk π
mwah π this page is from libcurl 7.37.0, dated 19 Jun 2014 β vintage but still slaying, periodt β¨π
π¦ 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