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
14---
15
16# NAME
17
18CURLOPT_NEW_FILE_PERMS - permissions for remotely created files
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_FILE_PERMS,
26                          long mode);
27~~~
28
29# DESCRIPTION
30
31Pass a long as a parameter, containing the value of the permissions that are
32set on newly created files on the remote server. The default value is *0644*.
33The only protocols that can use this are *sftp://*, *scp://*, and *file://*.
34
35# DEFAULT
36
370644
38
39# EXAMPLE
40
41~~~c
42int main(void)
43{
44  CURL *curl = curl_easy_init();
45  if(curl) {
46    CURLcode ret;
47    curl_easy_setopt(curl, CURLOPT_URL, "sftp://upload.example.com/file.txt");
48    curl_easy_setopt(curl, CURLOPT_NEW_FILE_PERMS, 0664L);
49    ret = curl_easy_perform(curl);
50  }
51}
52~~~
53
54# AVAILABILITY
55
56Added in 7.16.4
57
58# RETURN VALUE
59
60Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
61