Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
JohannesLesr opened this issue Feb 25, 2021 · 4 comments
Closed

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

JohannesLesr opened this issue Feb 25, 2021 · 4 comments
Assignees
Labels

Comments

@JohannesLesr
Copy link

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

@bagder
Copy link
Member

bagder commented Feb 25, 2021

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

@JohannesLesr
Copy link
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
Copy link
Member

bagder commented Feb 26, 2021

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

@bagder bagder self-assigned this Feb 26, 2021
bagder added a commit that referenced this issue Feb 26, 2021
The --create-file-mode code logic accepted the value but never actually
passed it on to libcurl!

Follow-up to a7696c7 (shipped in 7.75.0)
Reported-by: Johannes Lesr
Fixes #6657
@JohannesLesr
Copy link
Author

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

@bagder bagder closed this as completed in 40f3c18 Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants