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: What Am I Doing Wrong With cURL and SFTP?

From: Dan Fandrich via curl-users <curl-users_at_cool.haxx.se>
Date: Mon, 24 Aug 2020 00:55:18 -0700

On Mon, Aug 24, 2020 at 02:45:15PM +0700, Michael Newman via curl-users wrote:
> This works:
>
> pi_at_raspsky:~/webcam $ sftp mgnewman_at_ftp.myhost.com
> Connected to mgnewman_at_ftp.myhost.com.
> sftp> put testxx.jpg
> Uploading testxx.jpg to /home3/mgnewman/testxx.jpg
> testxx.jpg 100% 52KB 58.6KB/s 00:00
>
> This doesn't:
>
> pi@raspsky:~/webcam $ curl -k -u mgnewman: --key ~/.ssh/id_rsa --pubkey ~/.ssh/id_rsa.pub sftp://ftp.myhost.com/ -T "testxx.jpg"
> % Total % Received % Xferd Average Speed Time Time Time Current
> Dload Upload Total Spent Left Speed
> 0 0 0 0 0 0 0 0 --:--:-- 0:00:04 --:--:-- 0
> 0 0 0 0 0 0 0 0 --:--:-- 0:00:04 --:--:-- 0
> curl: (9) Upload failed: Permission denied (3/-31)
>
> What have I done wrong?

IIRC your syntax attempts to write the file to /testxx.jpg. Try sftp://ftp.myhost.com/~/
as the URL.

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