2016-03-28 74 views
0

嗨我正在通过远程桌面使用Windows Server 2008 R2。无法使用Windows中的Paramiko登录Linux服务器

我的要求是登录Linux机器并将包复制到Windows Server 2008机器。

但在第一阶段只有我卡住了,无法登录到Linux服务器。 我在远程桌面上编写了下面的代码。

def Package_Copying(self,timeout=60): 

    ssh=paramiko.SSHClient() 

    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) 

    ssh.connect("10.82.110.9",timeout=70,username='XXXX',password='XXXXX',look_for_keys=False) 



    ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command('ls -ltr') 

    print "output", ssh_stdout.read() 

    self.close() 

当我执行同样的操作时,我得到了下面的错误。

"error: (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')" 

,当我从腻子做同样的,我能够在其登录,但需要3或4秒内登录。

下面是在同一台服务器的平安跟踪

C:\Users\Administrator>ping 10.82.110.9 

Pinging 10.82.110.9 with 32 bytes of data: 

Reply from 10.82.110.9: bytes=32 time=229ms TTL=234 

Reply from 10.82.110.9: bytes=32 time=229ms TTL=234 

Reply from 10.82.110.9: bytes=32 time=230ms TTL=234 

Reply from 10.82.110.9: bytes=32 time=229ms TTL=234 


Ping statistics for 10.82.110.9: 

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), 

Approximate round trip times in milli-seconds: 

    Minimum = 229ms, Maximum = 230ms, Average = 229ms 


C:\Users\Administrator> 
+0

是Linux服务器你试图连接到运行SSH服务器,你可以连接?如果您不确定,可以尝试使用Windows中的PuTTY连接到服务器。 – vesche

+0

@vesche:原来的问题已经指出腻子被尝试过。然而,它没有说明是否涉及某种跳跃主持人。 – 0xC0000022L

+0

是的,从Putty我可以访问..即使我能够从Windows机器winscp ...只有问题是这个服务器是..它有点慢响应..意味着连接2秒。 你能帮我,以避免这种连接拒绝错误..谢谢 – user2160906

回答

0

我遇到类似的错误,当我设置的paramiko不正确的端口,尝试添加端口标志:

ssh.connect("10.82.110.9",port=22,timeout=70,username='XXXX',password='XXXXX',look_for_keys=False) 
相关问题