Host Key mismatch via script only

Advertisement

kclark-psgc
Joined:
Posts:
2
Location:
Okawville, IL

Host Key mismatch via script only

Using the GUI, I can connect to teh server and transfer no issues. I generate the open script while connected via the GUI, but when used in a script (windows bat file) it gives the error:

(sensitive data redacted)

Searching for host...
Connecting to host...
Authenticating...
Host key does not match configured key fingerprint "ssh-ed25519"!
Host key fingerprint is ssh-ed25519 255 1*******************************************M.
Authentication failed.

My bat file reads as follows:

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\Users\kclarka\Desktop\doclinks.log" /ini=nul ^
  /command ^
    "open sftp://***********:*************@***.***.***.***/ -hostkey="ssh-ed25519 255 1*******************************************M"" ^
    "cd /home/doclinks" ^
    "lcd ""e:\doclinks\attachments\""" ^
    "put -resumesupport=off -nopreservetime e:\doclinks\attachments\*.* /home/doclinks/*.*" ^
    "exit"

set WINSCP_DOWN_RESULT=%ERRORLEVEL%
if %WINSCP_DOWN_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)

The log file gives the following:

. 2025-07-10 13:41:09.160 DST mode: Unix
. 2025-07-10 13:41:09.160 --------------------------------------------------------------------------
< 2025-07-10 13:41:09.160 Script: Searching for host...
. 2025-07-10 13:41:09.160 Looking up host "***.***.***.***" for SSH connection
. 2025-07-10 13:41:09.160 Connecting to ***.***.***.*** port 22
. 2025-07-10 13:41:09.160 Connected to ***.***.***.*** (from ***.***.***.***)
< 2025-07-10 13:41:09.160 Script: Connecting to host...
. 2025-07-10 13:41:09.160 We claim version: SSH-2.0-WinSCP_release_6.5.2
. 2025-07-10 13:41:09.160 Connected to ***.***.***.*** (from ***.***.***.***)
. 2025-07-10 13:41:09.191 Remote version: SSH-2.0-OpenSSH_8.7
. 2025-07-10 13:41:09.191 Using SSH protocol version 2
. 2025-07-10 13:41:09.191 Enabling strict key exchange semantics
. 2025-07-10 13:41:09.191 Doing ECDH key exchange with curve Curve25519, using hash SHA-256
. 2025-07-10 13:41:09.269 Server also has ecdsa-sha2-nistp256/rsa-sha2-512/rsa-sha2-256 host keys, but we don't know any of them
. 2025-07-10 13:41:09.269 Host key fingerprint is:
. 2025-07-10 13:41:09.269 ssh-ed25519 255 SHA256:1*******************************************M
< 2025-07-10 13:41:09.269 Script: Authenticating...
. 2025-07-10 13:41:09.269 Host key does not match configured key fingerprint ssh-ed25519
. 2025-07-10 13:41:09.269 Attempt to close connection due to fatal exception:
* 2025-07-10 13:41:09.269 Host key fingerprint is ssh-ed25519 255 1*******************************************M.
* 2025-07-10 13:41:09.269 (Exception) **Host key does not match configured key fingerprint "ssh-ed25519"!**
. 2025-07-10 13:41:09.269 Closing connection.
< 2025-07-10 13:41:09.269 Script: Host key does not match configured key fingerprint "ssh-ed25519"!
< 2025-07-10 13:41:09.269 Host key fingerprint is ssh-ed25519 255 1*******************************************M.

< 2025-07-10 13:41:09.269 Authentication failed.

Is there something I do not have configured in WinSCP to generates the correct script or what am I missing?

Thanks for all,
Keith

Reply with quote

Advertisement

You can post new topics in this forum