With Posh-SSH, is there a way to provide the passphrase/password to use with an encrypted private key? (Password for the key file, not credentials for the SSH server connection)
I'm having no luck finding information on how to do it, or if it's even possible.
The SFTP server in question requires both the SSH keys, as well as a login password.
Posh-SSH will use "password" to decrypt encrypted private key.
$cred = New-Object System.Management.Automation.PSCredential($userName, $keyPassphrase)
$sftp = New-SFTPSession -ComputerName $hostname -Credential $cred -KeyFile $keyFile
Key passphrase and password are provided the same way (bad design, imo). I'm afraid that using two-factor key+password authentication in Posh-SSH might be difficult, if possible at all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With