I'm trying to use plink to establish a connection to a remote server and remove an entry in SIP user directory list using the following command:

plink root@<server-ip> -pw pwd serctl ul rm bob

which then asks the following:

The server's host key is not cached. You have no guarantee
that the server is the computer you think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 1024 5d:ae:ae:ad:46:71:30:6d:0c:0e:30:e1:cd:f7:6b:90
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
Store key in cache? (y/n)

This comes up if the command is executed for the very first time. If I'm executing this command in a script, it invariably asks the same in the interactive prompt, but since no response is given, asks the same a few more times and prints :

Store key in cache? (y/n) Connection abandoned.

From the man page of plink, I did get how to override the interactive prompt using -batch option, but I want to make sure that the response is positive i.e., a y. How can I make sure it is y explicitly? Is there a way I can add this to the command?


You might try the yes command if that is available on your distribution, see e.g.

for examples (and yes, these are two different questions despite the almost-same title).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.