Archive for April, 2011

Putty (plink) and unknown host key

Sunday, April 17th, 2011

Putty has announced that they will not allow automatic import of host key. You should press the damn ‘y’ yourself, or else, you will fail. A quote from their FAQ says: “A.2.9 Is there an option to turn off the annoying host key prompts?

No, there isn’t. And there won’t be. Even if you write it yourself
and send us the patch, we won’t accept it.
…”

And it goes on, blah, blah, blah. While I agree with posing limitations in the name of security, I do not agree with complete block of options. See, for example, the use of “–use-the-force-luke” option in growisofs. This is a great example of “We know you want it. We don’t like it, but we’ll still allow you, although we will make sure you understand that it’s something out of the ordinary”. I respect that. Putty creators, however, did not want it to be done, and will do their best to make sure it won’t be possible in the future.

A workaround goes like this:
Create a file called “yes.txt” with the following content:
y

(Notice that you need a ‘y’, and a new line). Save the file.

Run the following command, for your viewing pleasure:
plink.exe -l user -pw password server "date" < yes.txt
Your plink will get its ‘y’ answer, and be able to run the command.

Hope it helps. I’ve seen so many people asking about it on the net…