Skip to content

Option --create-file-mode has no effect #6657

Closed
@JohannesLesr

Description

@JohannesLesr

Hello Daniel,
Hello everybody,

I tried this new feature you kindly provided. Unfortunately it had no
effekt on the mode of the created file. Here is what I did. I used
Ubuntu 20.4.1 to compile the final version of curl 7.75.0 with the
following commands:

./configure --with-libssh2
make
sudo make install

and I got the following curl version without any warnings:

curl 7.75.0 (x86_64-pc-linux-gnu) libcurl/7.75.0 OpenSSL/1.1.1f
zlib/1.2.11 libssh2/1.8.0
Release-Date: 2021-02-03
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt
pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB
SSL TLS-SRP UnixSockets

I then tried to upload a file to localhost (same Ubuntu machine) several
times:

curl -k -u jojo:password --create-file-mode 777 -T Zahnpasta.txt
sftp://localhost/home/jojo/Documents/
curl -k -u jojo:password --create-file-mode 0777 -T Zahnpasta.txt
sftp://localhost/home/jojo/Documents/

The upload worked out without warnings but the file still has the 644
permissions .

What do I have to do to get this feature working?

Thanks in advance,

Johannes

Activity

bagder

bagder commented on Feb 25, 2021

@bagder
Member

Is that an openssh SFTP server in the other end? What umask do you run that with?

JohannesLesr

JohannesLesr commented on Feb 26, 2021

@JohannesLesr
Author

It's a default ubuntu installation. In my sshd_config I found the following line:

# override default of no subsystems
Subsystem sftp /usr/lib/openssh/sftp-server

and no other config-files are included. So I assume I'm using openssh SFTP.

My sshd-process runs as root and root has the umask 0022.
Even restricting the permissions to --create-file-mode 0600 has no effect.

bagder

bagder commented on Feb 26, 2021

@bagder
Member

Thanks, I can reproduce. Quite obviously my work on adding this option was only partial. PR coming up.

self-assigned this
on Feb 26, 2021
added a commit that references this issue on Feb 26, 2021
baff92d
JohannesLesr

JohannesLesr commented on Feb 26, 2021

@JohannesLesr
Author

Thanks, al lot! I copied the additional lines of tool_operate.c into my copy of 7.75.0, recompiled and it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @bagder@JohannesLesr

    Issue actions

      Option --create-file-mode has no effect · Issue #6657 · curl/curl