I am writing a batch script to connect to SFTP server having private key and passphrase.
I have developed a script using WinSCP. But if we use WinSCP we need to hard code passphrase which I feel is not the secured way to implement.
Is there any way to store passphrase in a file and pass that file name as argument or can we create a batch script to achieve this without using WinSCP?
Below is the script that I have implemented using WinSCP.
Batch file:
winscp.com /script=script.txt
Below is the content that I have included in script.txt file:
option echo off
option batch on
option confirm off
open sftp://username:password@hostname -privatekey="filename" -passphrase "passphrase"
put "filename" /
exit