在阅读以下行之前,您已经关闭了连接:
import paramikoclient=paramiko.SSHClient()client.set_missing_host_key_policy(paramiko.AutoAddPolicy())com="ls ~/desktop"client.connect('MyIPAddress',MyPortNumber, username='username', password='password')output=""stdin, stdout, stderr = client.exec_command(com)print "ssh succuessful. Closing connection"stdout=stdout.readlines()client.close()print "Connection closed"print stdoutprint comfor line in stdout: output=output+lineif output!="": print outputelse: print "There was no output for this command"
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)