Plink is a blessing if you are attempting to SSH to a remote machine and execute some scripts from an automated solution. It’s perfect for the scenario, except when it comes to hostkey acceptance.
Plink, or for that matter any application used to connect to another machine remotely, require you to accept the Hostkey of the machine before you run some operation on it. In my case, I use Winscp to transfer some scripts onto a remote machine, and Plink to run those scripts. While the command line interface to Winscp allows you to auto accept hostkeys, Plink does not – and also refuses any such support, citing compromises as a reason. Assuming you are unperturbed by these compromises, this post points you to a workaround.
cmd.exe /c echo y | plink.exe -v ssh 192.168.1.10 -P 22 -l root -pw P@$$w0rd "/usr/local/python3.4 run.py -this script -does -something -AWESOME"
– cmd.exe /c, ensures the following text is run as a command, and ensuring it is terminated when done
– echo y, automatically output’s y when prompted, accepting the fetched hostkey
The rest of command, executes a python script on a remote machine with plink.