Topic "script to automate winscp file download with certificate authentication"

Author Message
gautam.gupta1@...

Guest


I am working on a script which will automate the downloading of files from remote sftp server.
The issue is certificate authentication
Right now I am using Winscp GUI and in the advance settings of the Wincp session withe remote server I have supplied the SSL certificate.
Winscp connects to remote server using this certificate and once sessions is established I go to a remote directory and copy a file to local directory.
I need to automate this and schedule it so that in every 30 minutes the script is run and if a new file is copied to remote server directory, it will be copied to the local directory.
I have one script which works fine for FTP but for SFTP with certificate I need help in creating a script which can be used to connect to remote sftp server passing on certificate authentication and download the file.

Thanks
Gautam
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
SFTP does not use client certificates.
So either you mean private key (used with SFTP/SSH).
Or you mean FTPS (which uses TLS/SSL and hence the certificates).

For private key, use the -privatekey switch.
For client certificate, use the -clientcert switch.
https://winscp.net/eng/docs/scriptcommand_open

In any case, you have have the GUI generate the script for you:
https://winscp.net/eng/docs/ui_generateurl#script
gautam.gupta1@...

Guest


thanks Martin

I am able to connect to ftps using -privatekey and command link interface open sftp://test1:test123;fingerprint=ssh-rsa-xxxxxxxxxxxxxx -privatekey=<Filepath> -passphrase=XXXXX
Next step is to download any new file in the remote directory ( filename_xxxx.csv) to local directory....and write to a log file and send a status mail alert to specific email id.
can you help with this ?

Thanks
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
That's sftp, not ftps.

Anyway, start here:
https://winscp.net/eng/docs/faq_script_modified_files
https://winscp.net/eng/docs/guide_automation#results
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License