CURLOPT_NEW_FILE_PERMS.md (1257B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_NEW_FILE_PERMS 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_NEW_DIRECTORY_PERMS (3) 9 - CURLOPT_UPLOAD (3) 10 Protocol: 11 - SFTP 12 - SCP 13 - FILE 14 Added-in: 7.16.4 15 --- 16 17 # NAME 18 19 CURLOPT_NEW_FILE_PERMS - permissions for remotely created files 20 21 # SYNOPSIS 22 23 ~~~c 24 #include <curl/curl.h> 25 26 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_FILE_PERMS, 27 long mode); 28 ~~~ 29 30 # DESCRIPTION 31 32 Pass a long as a parameter, containing the value of the permissions that are 33 set on newly created files on the remote server. The default value is *0644*. 34 The only protocols that can use this are *sftp://*, *scp://*, and *file://*. 35 36 # DEFAULT 37 38 0644 39 40 # %PROTOCOLS% 41 42 # EXAMPLE 43 44 ~~~c 45 int main(void) 46 { 47 CURL *curl = curl_easy_init(); 48 if(curl) { 49 CURLcode ret; 50 curl_easy_setopt(curl, CURLOPT_URL, "sftp://upload.example.com/file.txt"); 51 curl_easy_setopt(curl, CURLOPT_NEW_FILE_PERMS, 0664L); 52 ret = curl_easy_perform(curl); 53 } 54 } 55 ~~~ 56 57 # %AVAILABILITY% 58 59 # RETURN VALUE 60 61 curl_easy_setopt(3) returns a CURLcode indicating success or error. 62 63 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 64 libcurl-errors(3).