curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: command-line tool / SFTP / 644 permissions

From: Dan Fandrich via curl-users <curl-users_at_cool.haxx.se>
Date: Wed, 23 Sep 2020 15:55:23 -0700

On Wed, Sep 23, 2020 at 04:47:00PM -0400, Aaron Couts via curl-users wrote:
> On Tue, Jun 23, 2015 Aaron Couts wrote:
> I recently ran into an issue while attempting to download a file from my
> SFTP server using the curl command-line tool.
>
> $ curl sftp://<user>:<password>@<server>/<file> -o <file>
> curl: (9) Could not open remote file for reading: Permission denied
>
> The remote file has 664 permissions, so there shouldn't be a permissions
> issue.  My SFTP server logs show that curl is attempting to change the
> permissions on the file:
>
> Jun 23 15:16:05 mod_sftp/0.9.7[15657]: error changing permissions of '/
> <file>' to 0100644: Operation not permitted
>
> My SFTP user is not the owner of the file, which is why the chmod command
> fails.  When I change the permissions from 664 to 644, I can download the
> file with curl, and my SFTP logs don't show any attempt to change the
> permissions.
>
> Is there any way to suppress the chmod command that curl is running?  I
> haven't been able to find anything about this in the documentation, the
> curl-users archive, or on google.  Hopefully I'm not missing something
> obvious.
>
> My SFTP server is ProFTPD 1.3.3g with mod_sftp.  I've tested this issue
> with curl 7.43.0 and 7.19.7.

I can't find any path in the code that would have curl do a chmod on its own in
such a case. The only time it does one that I can see is in response to the
"chmod" quote command (at least with the libssh2 backend). Are you sure that
it's curl doing it and not mod_sftp itself? And that there isn't a quote
command .curlrc or something set up to do a chmod?

Dan
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-09-24