I've been trying to issue commands using plink to retrieve information from my external server. Note that these plink commands are run from a binary that expects no input from the user. Is there a flag that will allow me to override this error message and continue with program output?
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 **:**:**:**:**:**:**:**:**:**:**:**:**:**:**:**
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
connection.
Store key in cache? (y/n)
Thank you!
Best Answer
Try prepending your script with:
This will pipe the
y
character throughstdin
toplink
when you get the Store key in cache? (y/n) prompt, allowing all furtherplink
commands to pass through without the need of user input. Theexit
command will close the SSH session after it has been established, allowing the followingplink
commands to run.Here's an example script which writes the external server's Unix time to a local file:
Pipelining Reference: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-4.html