Question

I am tranfering a file from one server to another using "Core FTP mini-sftp-server" on source side and WinSCP on destination side (both servers are running Windows).

I am logging in these two machine using local admin account which are same on both servers. I have been doing this process manually:

  • Start MSFTP server on source
  • Start WinSCP on destination, connect to source and get the file.

Now I want to automate it and i tried the following

Start msftp from command line on source.

On destination in winscp.exe console:

open login:password@IPAdress
get <file> <destination>
close
exit

The problem with this is if I do it for the first time everyday, it asks me to update the key at the destination side saying:

"WARNING POTENTIAL SECURITY BREACH! The server’s host key does not match the one WinSCP has is cache. This means that either the server administrator has charged the host key, the server presents different key under certain circumstances, or you have actually connected to another computer pretending to be the server"

I have to manually do it (click on Update) at first and then for the following copies, the automation works.

Question:

How can I update the key using cmd line while connecting to the server?

Can I prevent the source to generate new key daily? Or should I do it?

Was it helpful?

Solution

You should prevent the source server generating a new key - there is absolutely no reason to do so. The server's public key identifies the server, and so this identity shouldn't be changed.

OTHER TIPS

You are losing any security by connecting to a SSH server that changes public key every day.

Anyway, if that's your only option, recent WinSCP allows accepting any host key automatically using the -hostkey=* switch of the open command:

open -hostkey=*

You lose any security by doing that, but you are already, so it makes no difference.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top