(Exception) **Host key does not match configured key fingerprint "ssh-rsa 1024 KfH2Zul0c+lnIQ3vIRz7s

Advertisement

syedshareefahmed@gmail.com
Joined:
Posts:
2

(Exception) **Host key does not match configured key fingerprint "ssh-rsa 1024 KfH2Zul0c+lnIQ3vIRz7s

Hi,

I have a script (Batch file) for transferring files to a remote server with private keys provided by the party who owns the remote server. Sometimes I am receiving an error as below and files not been send.
(Exception) **Host key does not match configured key fingerprint "ssh-rsa 1024 KfH2Zul0c+lnIQ3vIRz7slq71crPirz+3ZkvwA5gulE="!**
My batch file is given below.
@echo off
 
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul ^
  /command ^
    "open sftp://user:password@remoteserver:10039/ -hostkey=""ssh-rsa 1024 KfH2Zul0c+lnIQ3vIRz7slq71crPirz+3ZkvwA5gulE="" -privatekey=""E:\FTPPIL\lmsprdedi01.openssh"" -rawsettings AgentFwd=1 KEX=""rsa,ecdh,dh-gex-sha1,dh-group14-sha1,WARN,dh-group1-sha1""" ^
    "cd Outbox/eqmvmt" ^
    "lcd C:\LINES\ProdFTPEDIOUT\PIL\Coarri" ^
    "put *.* -nopreservetime" ^
    "lcd C:\LINES\ProdFTPEDIOUT\PIL\Codeco" ^
    "put *.* -nopreservetime" ^
    "exit"
 
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)
 
exit /b %WINSCP_RESULT%

Kindly help me to resolve this issue, looking forward to your earliest support and co-operation.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
36,025
Location:
Prague, Czechia

Re: (Exception) **Host key does not match configured key fingerprint "ssh-rsa 1024 KfH2Zul0c+lnIQ3vIRz7s

Where did you get the ssh-rsa 1024 KfH2Zul0c+lnIQ3vIRz7slq71crPirz+3ZkvwA5gulE= from?
A fingerprint of the host key of the server you are connecting to is ssh-rsa 1024 2aQE3Q82arBxCXSCUeGF3HqfeYMh25YX9bVc5g1Qmhc=.
Either you have done something wrong or the hostkey has changed or you are under MITM attack.

Reply with quote

syedshareefahmed@...
Guest

Re: (Exception) **Host key does not match configured key fingerprint "ssh-rsa 1024 KfH2Zul0c+lnIQ3vIRz7s

Thanks a lot Mr. Martin for responding.

I have got this fingerprint from the script WinSCP 'Generate Session URL/Code' of Manage option after login with credentials provided by the receiver of the files by remotely. And the host key also has provided by them.

A screenshot for reference also attached.
Description: The fingerprint of the host key got from Manage-> Generate Session URL/Code after login to WinSCP. And the host key provided by one of our stakeholders to receive files remotely.

Reply with quote

martin
Site Admin
martin avatar

Re: (Exception) **Host key does not match configured key fingerprint "ssh-rsa 1024 KfH2Zul0c+lnIQ3vIRz7s

What if you first log in, then go to Session > Generate Session URL/Code?

Reply with quote

Advertisement

syedshareefahmed@...
Guest

Re: (Exception) **Host key does not match configured key fingerprint "ssh-rsa 1024 KfH2Zul0c+lnIQ3vIRz7s

Dear Martin,
Yes, your are correct, the host key was generated when I do log then, goto Session > Generate Session URL/Code.

Reply with quote

martin
Site Admin
martin avatar

Re: (Exception) **Host key does not match configured key fingerprint "ssh-rsa 1024 KfH2Zul0c+lnIQ3vIRz7s

I'm not sure I understand. So is it working now?

Reply with quote

jamal
Guest

Attempt to close connection due to fatal exception: (Exception) **Host key does not match configured

Hi Admin,
Attempt to close connection due to fatal exception:
Host key fingerprint is ssh-rsa 2048 39:31:0f:55:44:cb:50:f4:e0:77:92:42:68:69:b6:d9.
(Exception) **Host key does not match configured key "ssh-rsa 2048 SHA256:6z1CCrRQ6u0G+4POB4jD+bsPFdHPIcX3Mp/lazJyjTE"!**
I have a Batch file for transferring files to a remote server with private key.

Could you please help me on this.

Reply with quote

martin
Site Admin
martin avatar

Re: Attempt to close connection due to fatal exception: (Exception) **Host key does not match configured

@jamal: Sorry, but your question is unclear. Is this new script? Was is ever working? If it is a new script, where did you take the fingerprint in your script from? If it was working before, did you expect the host key change?

Reply with quote

Advertisement

You can post new topics in this forum