如何将echo y传递给plink.exe文件第一次连接

2024-04-20 07:42:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我想把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)


Tags: 文件thetokeyinechoyouhost
2条回答

确认服务器的SSH密钥指纹是一个重要的步骤。这就是您如何知道您已连接到正确的机器,并且应该始终小心操作。在

Plink文档makes the following suggestion

To avoid being prompted for the server host key when using Plink for an automated connection, you should first make a manual connection (using either of PuTTY or Plink) to the same server, verify the host key (see section 2.2 for more information), and select Yes to add the host key to the Registry. After that, Plink commands connecting to that server should not give a host key prompt unless the host key changes.

不要!

验证主机密钥指纹是确保连接安全的一个组成部分。盲目接受任何主机密钥将使您容易受到man-in-the-middle attacks的攻击。在


相反,使用^{} switch提供预期/已知主机密钥的指纹。在

c:/netapp/python/plink.exe admin@192.168.1.1 -pw xxx -hostkey 9d:08:37:a8:d0:34:a3:d2:d8:e5:09:7e:63:08:a9:1b uptime 

不要使用像feeding y这样的方法来连接输入。不仅不安全。但是如果没有主机键提示(因为主机键已经被缓存),y将作为正在执行的命令的输入结束。可能导致不希望的结果。在

相关问题 更多 >