I am scripting in PowerShell. I send the following commands using
SessionOptions
and keep getting the results below from the log file. I've successfully connected with the WinSCP client app using the PPK and the passphrase. I just can't get it to work via the PowerShell script. I'm not sure what I'm missing or should be doing differently.
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Sftp
HostName = "<my host name>"
UserName = "<myusername>"
PrivateKeyPassphrase = "<mypassphrase>"
SshPrivateKeyPath = "<pathformyPPK>"
SshHostKeyFingerprint = "<ssh rsa fingerprint>"
}
This is the from the log file:
Reading key file "<pathformyPPK>"
Using username "<myusername>".
Script: Using username "<myusername>".
Server offered these authentication methods: publickey
Offered public key
Offer of public key accepted
Authenticating with public key "<mypublickey>"
Script: Authenticating with public key "<mypublickey>".
Prompt (passphrase, "SSH key passphrase", <no instructions>, "Passphrase for key "<mypublickey>": ")
Using configured passphrase.
Wrong passphrase
Script: Wrong passphrase.