Topic "Add host key to cache"

Author Message
Keat

Guest


I am working on a web site connecting to another server via SFTP. On my local machine, the following basic script runs fine:
/command "option batch on" "option confirm off" "open sftp://userid:pwd@com.server.net" "exit "

But when I move the web site to the server, I get an error:
. 2010-05-13 11:27:29.928 Asking user:
. 2010-05-13 11:27:29.928 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.
. 2010-05-13 11:27:29.928
. 2010-05-13 11:27:29.928 The server's rsa2 key fingerprint is:
. 2010-05-13 11:27:29.928 ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
. 2010-05-13 11:27:29.928
. 2010-05-13 11:27:29.928 If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection press Cancel.
. 2010-05-13 11:27:29.928
. 2010-05-13 11:27:29.928 Continue connecting and add host key to the cache? ()

I managed to get it to work on the web server using this script:
/command "option batch continue" "option confirm off" " open sftp://userid:pwd@com.server.net -hostkey=""ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"" " exit "

My question is, how do I add the key to the cache on the web server so that I don't have to hardcode the key? And why is it working on my local machine but not on the web server?

In my script on the web server, I tried adding "Yes" but no success:
/command "option batch continue" "option confirm off" " open sftp://userid:pwd@com.server.net " "Yes" "Yes" " exit "

The web server is Windows 2008 64-bit. My local machine which I'm developing on is a Windows 7 64-bit. Both WinSCP install is in Program Files (x86).

Thanks very much for any input you can provide.
Keat
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Keat wrote:
My question is, how do I add the key to the cache on the web server so that I don't have to hardcode the key?

What advantage of caching it over hardcoding it? Isn't it the same? Anyway, just copy the host key registry key from your account on your local machine to the webserver account on the server machive.

Quote:
And why is it working on my local machine but not on the web server?

You have the key cached already on your local machine most probably.
_________________
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