Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

iannone

I have sorted it, thank you to Co-Pilot... :)
I'm happy to provide the scripts if anyone needs them.
iannone

command

What command do I use?

I have the passphrase in a file called passphrase.txt and it's formatted UTF-8.

Thanks
martin

Re: Authentication using a "Passphrase" for a private key.

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
iannone

Authentication using a "Passphrase" for a private key.

Hello, I am trying to automate a secure file copy with WinSCP using private and public keys for authentication. I can get it to work if I use the passphrase in the command but I want to pull the passphrase from a txt file.
The batch file is simple:
cd\
"c:\Program Files (x86)\WinSCP\WinSCP.exe" /log=c:\test\app.log /ini=nul /script=C:\test\app.txt

The script is:
open sftp://user@testsite.com:2022 -hostkey="ssh-randomcharaters" -privatekey="C:\Program Files (x86)\WinSCP\private.ppk" -passphrase="actual passphrase"
cd /temp/test
put c:\test\testfile.csv

It works perfectly if I have the actual passphrase but if I try -passwordsfromfiles, I cannot get it to work. Authentication fails...
Can someone help with the actual command to get the passphrase from a text file please? I have formatted the file UTF-8.
Thanks in advance