1CURLOPT_NEW_FILE_PERMS(3) curl_easy_setopt options CURLOPT_NEW_FILE_PERMS(3)
2
3
4
6 CURLOPT_NEW_FILE_PERMS - permissions for remotely created files
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_FILE_PERMS,
12 long mode);
13
15 Pass a long as a parameter, containing the value of the permissions
16 that will be assigned to newly created files on the remote server. The
17 default value is 0644, but any valid value can be used. The only pro‐
18 tocols that can use this are sftp://, scp://, and file://.
19
21 0644
22
24 SFTP, SCP and FILE
25
27 CURL *curl = curl_easy_init();
28 if(curl) {
29 CURLcode ret;
30 curl_easy_setopt(curl, CURLOPT_URL, "sftp://upload.example.com/file.txt");
31 curl_easy_setopt(curl, CURLOPT_NEW_FILE_PERMS, 0664L);
32 ret = curl_easy_perform(curl);
33 }
34
36 Added in 7.16.4
37
39 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
40 if not.
41
43 CURLOPT_NEW_DIRECTORY_PERMS(3), CURLOPT_UPLOAD(3),
44
45
46
47libcurl 7.85.0 May 17, 2022 CURLOPT_NEW_FILE_PERMS(3)