Add correct host key in /ua/username/.ssh/knownhosts to get rid of this. Or are concerned the server's public key change is not intentional,.
Active1 year, 8 months ago
I'm trying to establish a connection to SFTP server with following code, I'll receive this error message 'Host key wasn't verified!'.
But if I establish a connection using following code, I'm able to connect.
I'm so curious to know what I have done wrong in the first method?
Martin Prikryl103k2727 gold badges216216 silver badges456456 bronze badges
huahsin68huahsin68
3,1461616 gold badges6969 silver badges105105 bronze badges
1 Answer
Your host key fingerprint format is wrong. You are missing a key type (
ssh-rsa
or ssh-dss
) at least.See WinSCP FAQ Where do I get SSH host key fingerprint to authorize the server?
Your code that uses scripting succeeds because you have the fingerprint cached. The .NET assembly never uses fingerprint cache.
The latest versions of WinSCP issue a more meaningful message when the fingerprint is not matched.
Martin PrikrylMartin Prikryl103k2727 gold badges216216 silver badges456456 bronze badges