OK thanks
- Master468
-hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
$sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"xx:xx:xx:... is just a placeholder for the actual key fingerprint, not a literal value.
xx:xx:xx:... in the script, it is ignored. If the script works with the xx:xx:xx:..., it means the script relies on the GUI configuration for the host key verification, what is not recommended. Just as if the -hostkey switch was not even present.
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.HostName = "example.com"
$sessionOptions.UserName = "user"
$sessionOptions.Password = "password"
$sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
$session = New-Object WinSCP.Session
"ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" which is what I am trying to accomplish in VB.NET but it is not working. Is there a reason this does not work in VB.NET?
I'm looking to retrieve a file via SFTP from several remote systems (I've already connected to all the systems and the keys have been added to Putty's cache).
When usingwinscp.comI can use:open sftp://username:password@10.22.49.14/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
-hostkey switch has an invalid syntax and is effectively ignored. You could have used -hostkey="huhu" with the same effect.
winscp.com I can use:
open sftp://username:password@10.22.49.14/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
System.ArgumentException: SSH host key fingerprint does not match pattern
.SshHostKeyFingerprint = "ssh-rsa 2048 9e:f1:1e:93:91:37:ed:dd:ee:51:4e:c4:66:6f:bb:68"
winscp.com so I can just use "xx:xx:xx..." for all the systems I connect to?