Plink: Auto Accept HostKey’s

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.

Execute this,

cmd.exe /c echo y | plink.exe -v ssh -P 22 -l root -pw P@$$w0rd "/usr/local/python3.4 -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.

Exposing SOAP webservices through ColdFusion 2016 API Manager
The MySQL/Python Connector Saga

By Immanuel Noel

A techie at heart. Works with Adobe at Bangalore, India. Currently do DevOps. Been a part of the ColdFusion Engineering team and the Flash Runtime Engineering team in the past. Was also a Flash Platform Evangelist, evangelizing the Adobe Flex platform. Spoke at numerous ColdFusion / Flash and Flex tech conferences. This blog is a collection of the more interesting problem and solutions I have worked on.

More on me on the home page

Leave a Reply

Your email address will not be published. Required fields are marked *