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

Author Message
Almir

Guest


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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Please read:
http://winscp.net/eng/docs/scripting#hostkey
or
http://winscp.net/eng/docs/faq_scheduler
_________________
Martin Prikryl
rkn

Guest




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.
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.
Almir

Guest


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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
[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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
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:
http://winscp.net/eng/docs/faq_scheduler
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License