Authentication using a "Passphrase" for a private key.

Advertisement

iannone
Joined:
Posts:
3

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

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.

Reply with quote

Advertisement

You can post new topics in this forum