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: Aaron Couts via curl-users <curl-users_at_cool.haxx.se>
Date: Wed, 23 Sep 2020 16:47:00 -0400

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 posted this issue five years ago and have run into it again. Daniel
Stenberg responded to my original post, and I did not follow up -- my
apologies. Due to the delay I'm including my original post and Daniel's
response.

On Mon, Jun 29, 2015 Daniel Stenberg wrote:

> This is really an issue with libssh2 which is doing all the raw SFTP stuff.
> Which version of libssh2 are you using?

Most recently I've replicated this issue, exactly as described above, with
the following versions:

curl 7.19.7
libssh2 1.4.2-2 (from the CentOS 6 yum repository)

curl 7.61.1
libssh2 1.4.2-3.12 (from the AWS yum repository)

curl 7.72.0
libssh2 1.9.0 (on OS X, version # according to formulae.brew.sh -- I
installed it today)

Proftpd is v1.3.3g. I haven't tried this with any custom builds of curl or
libssh2.

Thanks,
Aaron

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