Hostkey not recognized if logged off of machine

Advertisement

hma@soundcu.com
Joined:
Posts:
4
Location:
Seattle

Hostkey not recognized if logged off of machine

I have a batch script that I initiate from an SSIS Package that is launched from a job in SSMS. When I am logged on my SQL Server, I can launch my job and it connects fine, but when I am not logged into the SQL Server, it fails, saying the "Host key does not match configured key fingerprint...". I need my batch script to work when I'm not logged into my SQL Server.

This is my script:
option confirm off
open sftp://xxxxxx -hostkey="xxxxx"
cd /upload
binary
get -latest "%1%" "%2%"\
exit
I tried using a password, but per the logs, it's asking if I want to continue, which I can't respond, as it's coming from my script.

How do I resolve this?

Thanks!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
38,408
Location:
Prague, Czechia

Re: Hostkey not recognized if logged off of machine

The hostkey fingerprint in your script is most likely incorrect. Your SQL server account probably has the correct hostkey cached in Windows registry, so WinSCP uses the cache to verify the host key, despite incorrect fingerprint in your script.

Somewhat related to:
My script works fine when executed manually, but fails or hangs when run by Windows Scheduler, SSIS or other automation service. What am I doing wrong?

If you believe otherwise, please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

hma@soundcu.com
Joined:
Posts:
4
Location:
Seattle

Hostkey not recognized if logged off of machine

Thanks for replying to my question post Martin! How then do I establish the correct fingerprint that I can use for my script?

thanks so much for your help!
  • private.zip (4.67 KB, Private file)

Reply with quote

hma@soundcu.com
Joined:
Posts:
4
Location:
Seattle

Hostkey not recognized if logged off of machine

Sorry, I meant to include a snipit of the hostkey. I double checked and it's the same as what's in my script.
  • session_server_protocal.png (64.17 KB, Private file)

Reply with quote

Advertisement

You can post new topics in this forum