New host key every day using MSFTP and WinSCP
I am transferring a file from one server to another using the "main mini-sftp-server" FTP server on the source side and WinSCP on the destination side (both servers are running Windows).
I register these two machines using a local administrator account which is the same on both servers. I am doing this process manually:
- Start MSFTP Server at Source
- Run WinSCP at the destination, connect to the source and get the file.
Now I want to automate it and I tried the following
Run msftp
from command line at source.
At destination in console winscp.exe
:
open login:password@IPAdress
get <file> <destination>
close
exit
The problem with this is that if I do this for the first time every day, it asks me to update the key on the target side, saying:
"POTENTIAL SECURITY WARNING! The server host key does not match with one WinSCP has a cache. This means that either the server administrator has charged the host key, the server presents a different key under certain circumstances, or you are indeed connected to another computer pretending to be a server."
I need to do it manually (first click "Update") and then for the next copies, the automation works.
Question:
How can I update the key using the cmd line when connecting to the server?
Is it possible to prevent the source from generating a new key daily? Or should I do this?
source to share
You lose any security by connecting to an SSH server changing the public key every day.
Anyway, if that's the only option, recent WinSCP allows you to automatically accept any host key using the command switch : -hostkey=*
open
open -hostkey=*
You lose any security by doing this, but you already are, so it doesn't really matter.
source to share