1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_NEW_FILE_PERMS 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_NEW_DIRECTORY_PERMS (3) 9 - CURLOPT_UPLOAD (3) 10Protocol: 11 - SFTP 12 - SCP 13 - FILE 14Added-in: 7.16.4 15--- 16 17# NAME 18 19CURLOPT_NEW_FILE_PERMS - permissions for remotely created files 20 21# SYNOPSIS 22 23~~~c 24#include <curl/curl.h> 25 26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_FILE_PERMS, 27 long mode); 28~~~ 29 30# DESCRIPTION 31 32Pass a long as a parameter, containing the value of the permissions that are 33set on newly created files on the remote server. The default value is *0644*. 34The only protocols that can use this are *sftp://*, *scp://*, and *file://*. 35 36# DEFAULT 37 380644 39 40# %PROTOCOLS% 41 42# EXAMPLE 43 44~~~c 45int 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 61Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 62