up vote
12
down vote
favorite
4
|
i've been trying to issue commands using plink to retrieve information from my external server. note that these plink commands are ran 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!
linux
ssh
bash
putty
host
share
improve this question
|
edited Aug 23 '12 at 18:44
|
asked
Aug 23 '12 at 18:28
|
|
|
add a comment
|
up vote
11
down vote
accepted
|
Try prepending your script with:
echo y | plink -ssh root@REMOTE_IP_HERE "exit"
This will pipe the y character through stdin to plink when you get the Store key in cache? (y/n)prompt, allowing all further plink commands to pass through without the need of user input. The exit command will close the SSH session after it has been established, allowing the following plink commands to run.
Here's an example script which writes the external server's Unix time to a local file:
echo y | plink -ssh root@REMOTE_IP_HERE "exit"
plink -ssh root@REMOTE_IP_HERE "date -t" > remote_time.tmp
Pipelining Reference: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-4.html
share
improve this answer
|
edited Aug 23 '12 at 20:42
|
answered
Aug 23 '12 at 18:29
| |
|
add a comment
|
up vote
0
down vote
|
maybe, it will help:
plink -auto_store_sshkey -batch 192.211.158.256 -l user -pw password command
share
improve this answer
|
edited Jan 14 '14 at 15:45
Michael Hampton
♦
114k
16
186
381
|
answered
Jan 14 '14 at 15:43
| |
|
|
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)