在Python中使用SSH和Paramiko连接到远程服务器失败

时间:2014-09-16 15:40:25

标签: python ssh paramiko

我最近从https://pypi.python.org/pypi/ssh/1.7.14为我的Python 2.7 64位

下载并安装了SSH

然后我尝试连接到网络上的虚拟机服务器。我有完全授权可以访问它。我的代码是:

import ssh
import paramiko


if __name__ == '__main__':  
    ssh = paramiko.SSHClient()

    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())

    ssh.connect('10.92.15.12', username = "testUser", password = "testPwd")

但是,我有以下错误:

Traceback (most recent call last):
  File "C:\Users\testUser\Documents\Aptana Studio 3 Workspace\testProj\testRemoteExecution.py", line 56, in <module>
    ssh.connect('10.92.15.12', username = "testUser", password = "testPwd")
  File "C:\Python27\lib\site-packages\paramiko\client.py", line 283, in connect
    sock.connect((hostname, port))
  File "C:\Python27\lib\socket.py", line 222, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 10061] No connection could be made because the target machine actively refused it

我在这里犯了什么错误吗?

感谢。

0 个答案:

没有答案