Add host key to cache

Advertisement

Keat
Guest

Add host key to cache

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Add host key to cache

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.

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.

Reply with quote

Advertisement

You can post new topics in this forum