我想把echo y
传给plink.exe文件,以便plink执行命令。
如何实现?在
os.system(' c:/netapp/python/plink.exe admin@192.168.1.1 -pw xxx uptime > c:/netapp/python/12.txt')
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 9d:08:37:a8:d0:34:a3:d2:d8:e5:09:7e:63:08:a9:1b If you trust this host, enter "y" to add the key to
Store key in cache? (y/n)
确认服务器的SSH密钥指纹是一个重要的步骤。这就是您如何知道您已连接到正确的机器,并且应该始终小心操作。在
Plink文档makes the following suggestion:
不要!
验证主机密钥指纹是确保连接安全的一个组成部分。盲目接受任何主机密钥将使您容易受到man-in-the-middle attacks的攻击。在
相反,使用^{} switch 提供预期/已知主机密钥的指纹。在
不要使用像feeding
y
这样的方法来连接输入。不仅不安全。但是如果没有主机键提示(因为主机键已经被缓存),y
将作为正在执行的命令的输入结束。可能导致不希望的结果。在相关问题 更多 >
编程相关推荐