Using Passphrase in Command Line

Advertisement

klee@selco.org
Joined:
Posts:
3
Location:
Oregon

Using Passphrase in Command Line

I have a 3rd party vendor I'm trying to connect to via WinSCP, and I'll need to automate the process so I'm trying to figure out how to connect to this vendor using their Private key which requires a passphrase. I'm on version 6.3.7. I have able to connect to their SFTP site with the WinSCP GUI when I key in the passphrase, but I'm not having much luck through command line. Here's what I have now:
winscp.com /command "open sftp://username:""@site:22/" "get /outgoing/file.pgp C:\TEMP\file.pgp" -privatekey="E:\Key\SSH_Key.ppk" passphrase=""the passphrase""  "exit"

Reply with quote

Advertisement

klee@selco.org
Joined:
Posts:
3
Location:
Oregon

Thanks, I actually got this working with the following:
winscp.exe SITENAME /passphrase="The passphrase" /command "get /RemoteFile.txt.pgp LocalPath.txt.pgp" "exit"

Reply with quote

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

That works too. But it's not recommended syntax.

Only now I have noticed that you have more problems in your original syntax. So my previous post was not enough. The -privatekey and -passphrase should go to the open command, not put. And the quotes for -privatekey should be double too (or removed as they are not needed).
winscp.com /command "open sftp://username:""@site:22/ -privatekey=""E:\Key\SSH_Key.ppk"" -passphrase=""the passphrase""" "get /outgoing/file.pgp C:\TEMP\file.pgp"  "exit"

Reply with quote

Advertisement

You can post new topics in this forum