cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: replace psftp for curl.exe

From: Ray Satiro <raysatiro_at_yahoo.com>
Date: Wed, 02 Jul 2014 14:09:22 -0400

On 7/2/2014 9:35 AM, Hilgersom, Danny wrote:
>
> Hi,
>
> We are using curl.exe as a command line tool on the Windows platform.
> For SSH FTP connections we use psftp.exe. We want to simplify our ftp
> tooling and therefore we want to use curl also as our primary SSH FTP
> tool. Form what I could find, you need to locate the public key at the
> server side. With Ppsftp this is not necessary. Could someone confirm
> this for me?
>
> Below is the command line we use when using psftp.exe:
>
> psftp.exe" -v -batch -i C:\Temp\testkey.ppk -pw <ourpass> -b
> "C:\Temp\filestoupload.txt" <user>@<host>.com
>
> Also, could someone with more knowledge then I have convert this
> command line into the command line which I should use for curl.exe?
>

To use curl sftp you'll have to convert your ppk key. Open puttygen and
load the ppk. It also contains your public key. You will see text in a
window "public key for pasting into openssh". Copy that into a file
pub.txt. It should be a single line. Then Conversions > Export OpenSSH
key and save it as priv.txt.

Then you can do this:

curl -u username:password --key priv.txt --pubkey pub.txt sftp://hostname/

Sometimes you don't need a password when authenticating with a key, if
so leave it off but you'll still need the colon:
-u username:

I don't know if you can use a command file, I took a look at the command
line options but I don't see it. You can send some limited commands
using -Q repeatedly like -Q pwd for example.
http://curl.haxx.se/libcurl/c/CURLOPT_QUOTE.html

There may be a way to do exactly what you want, I don't know.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-07-02