2016-03-28 31 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) 
相關問題