The server's host key was not found in the cache.

Advertisement

Almir
Guest

The server's host key was not found in the cache.

When i execute the batch file manually the remote server asked me to confirm the host key and add it in the cache. Once i did that it opened fine. When i schedule the batch file through SQL scheduled tasks it failes. It gives me the error that it waited for user input on the host confirmation.
********************
Asking user:
The server's host key was not found in the cache. You have no guarantee that the server is the computer you think it is.
The server's dss key fingerprint is:
ssh-dss 1234 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection press Cancel.
Continue connecting and add host key to the cache? ()
*********************

Any ideas on how to get around this?
I already tried using the IP instead of host address but that didn't make any difference.

This is what i have in the script:
# Automatically answer all prompts negatively not to stall the script on errors
# option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
cd /upload
put D:\SFTP_ECHO\to_echo\p1789217184_Support*
# Disconnect
close
# Exit WinSCP
exit

Reply with quote

Advertisement

rkn
Guest

Re: The server's host key was not found in the cache.

martin wrote:


Hi,

I'm using the below script but it's always gives this error "The server's host key was not found in the cache. You have no guarantee that the server is the computer you think it is."

"winscp.exe" /console /command "option confirm off" "option batch continue" "open userid:pwd@abc.com" -hostkey="ssh-rsa 1111 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" "cd /out" "option transfer binary" "synchronize local \\abc\data\files\"


if i remove the "option batch continue" from the command then it's promting me to select
Yes, No, Cancle or Copy, if i choose manually Yes then it's working fine.

"winscp.exe" /console /command "option confirm off" "open userid:pwd@abc.com" -hostkey="ssh-rsa 1111 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" "cd /out" "option transfer binary" "synchronize local \\abc\data\files\"


Please help me to fix this issue so that i can schedule this one. Appreciate your help.

Reply with quote

rkn
Guest

I solved the issue.

When I ran the script from the above post with admin account the "server's host key" stores in the cache and worked fine.

Reply with quote

Almir
Guest

Re: The server's host key was not found in the cache.

I read the documentation and tried using a few different options yet i get the same warning error. If i execute manually it works fine. So i extracted the registry key and imported it to all users registry. It still doesn't work. I used the destination server's IP in the connect string and that didn't help either. My batch file calls the text file that holds the script code i posted above.

Any ideas?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: The server's host key was not found in the cache.

[quote="rkn"]"winscp.exe" /console /command "option confirm off" "option batch continue" "open userid:pwd@abc.com" -hostkey="ssh-rsa 1111 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" "cd /out" "option transfer binary" "synchronize local \\abc\data\files\"[quote]
Actually correct syntax is:
"winscp.exe" /console /command "option confirm off" "option batch continue" "open userid:pwd@abc.com -hostkey=""ssh-rsa 1111 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx""" "cd /out" "option transfer binary" "synchronize local \\abc\data\files\"
_________________
Martin Prikryl

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: The server's host key was not found in the cache.

Almir wrote:

I read the documentation and tried using a few different options yet i get the same warning error. If i execute manually it works fine. So i extracted the registry key and imported it to all users registry. It still doesn't work. I used the destination server's IP in the connect string and that didn't help either. My batch file calls the text file that holds the script code i posted above.
You have to import the settings to the account prive registry hive. WinSCP does not load these settings from all users registry.
Make sure you read:
https://winscp.net/eng/docs/faq_scheduler
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum