Host Key Not Configured
I am trying to create a scheduled task to upload and delete some files. I am getting a host key error when calling my script from a batch file. However if I open
WinSCP.comand paste each line in individually, they all work flawlessly. I added the
-hostkey=*to my open command and it still says there is a host key error.
"C:\WinSCP\winscp.com" /script=filename.txt /log=brwinscp.log /ini=nul
open sftp://brftp:workingpassword@serverIP:2222 -hostkey=* put -delete c:\FTP\brftp\FileNameID_* / exit
. 2023-01-09 15:23:01.217 Remote version: SSH-2.0-CrushFTPSSHD
. 2023-01-09 15:23:01.218 Using SSH protocol version 2
. 2023-01-09 15:23:01.282 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
. 2023-01-09 15:23:01.761 Server also has rsa-sha2-256/ssh-rsa/ssh-dss host keys, but we don't know any of them
. 2023-01-09 15:23:01.761 Host key fingerprint is:
. 2023-01-09 15:23:01.761 ssh-rsa 4096 SHA256:KQU3bUJpxEZzhK9JunBzk/2P8fLL6RLlRkBBzrLyqzY
< 2023-01-09 15:23:01.761 Script: Authenticating...
. 2023-01-09 15:23:01.762 Attempt to close connection due to fatal exception:
* 2023-01-09 15:23:01.762 Host key fingerprint is ssh-rsa 4096 KQU3bUJpxEZzhK9JunBzk/2P8fLL6RLlRkBBzrLyqzY.
* 2023-01-09 15:23:01.762 (Exception) **Expected host key was not configured, use -hostkey switch.**
. 2023-01-09 15:23:01.762 Closing connection.
< 2023-01-09 15:23:01.764 Script: Expected host key was not configured, use -hostkey switch.
< 2023-01-09 15:23:01.764 Host key fingerprint is ssh-rsa 4096 KQU3bUJpxEZzhK9JunBzk/2P8fLL6RLlRkBBzrLyqzY.