Python Paramiko模块和Openssh Windows 10

时间:2019-01-31 16:27:02

标签: python windows ssh paramiko

我是否需要在Windows中添加默认情况下没有的OpenSSH功能才能使用Paramiko模块?

我正在尝试在两台Windows 10 PC之间进行通信。

首先我遇到了这个错误

socket.error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

禁用防火墙后,现在出现此错误:

raise NoValidConnectionsError(errors)
paramiko.ssh_exception.NoValidConnectionsError: [Errno None] Unable to connect to port 22 on  or [IP ADDRESS]

下面是代码。我只是想做一些简单的检查连接。主机名,用户名和密码在真实代码中不能为空。

import paramiko
ssh_client=paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect(hostname="", username="", password="")
stdin,stdout,stderr = ssh_client.exec_command("dir")
print(stdout.readlines())

0 个答案:

没有答案