2012-09-22 83 views
2

我使用Python的paramiko包連接到遠程Unix機器。我寫了這個代碼:使用Python連接到遠程機器時出現套接字錯誤

import paramiko 
import sys 
import os 
import os.path 
passwd = "XXX" 
ssh = paramiko.SSHClient() 
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) 
ssh.connect("173.15.13.28", "root", password=passwd) 
stdin, stdout, stderr = ssh.exec_command('ls') 
x = stdout.readlines() 
print x 
for line in x: 
    print line 
ssh.close() 

執行我收到此錯誤後:

Traceback (most recent call last): 
    File "<pyshell#9>", line 1, in <module> 
     ssh.connect("173.15.13.28", "root", password="--------") 
    File "C:\Python27\lib\site-packages\paramiko\client.py", line 282, in connect 
     for (family, socktype, proto, canonname, sockaddr) in socket.getaddrinfo(hostname, port,socket.AF_UNSPEC, socket.SOCK_STREAM): 
    gaierror: [Errno 10109] getaddrinfo failed 

我不知道是什麼問題。

+3

你或許應該立即更改密碼。 – Mysticial

回答

相關問題