我的代码是:
ssh=paramiko.SSHClient()
ssh.connect('somehost.com',username='someuser',password='secretpw')
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.load_system_host_keys()
ssh.connect('somehost.com',username='someuser',password='secretpw')
我收到以下消息:
File "<stdin>", line 1, in <module>
File "build\bdist.win-amd64\egg\paramiko\client.py", line 251, in connect
File "build\bdist.win-amd64\egg\paramiko\util.py", line 270, in retry_on_signal
File "build\bdist.win-amd64\egg\paramiko\client.py", line 251, in <lambda>
File "C:\Python27\lib\socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 10061] No connection could be made because the target
machine actively refused it
“paramiko”版本是1.15.2。
另一个注意事项是另一个人在Linux机器上安装“paramiko”并能够与其他机器建立SSH连接。
我也可以通过ip地址和我正在使用的paramiko
连接Putty