Paramiko身份验证失败?

2024-07-01 06:51:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我试过把它修好,但每次都犯同样的错误。我试过好几次,也在谷歌上试过,但都不能给出一个合适的答案。在

def ssh(hostname, command):

   sshcon = paramiko.SSHClient()

   logging.basicConfig()

   sshcon.load_system_host_keys()

   sshcon.set_missing_host_key_policy(paramiko.AutoAddPolicy())

   sshcon.connect(hostname, username='root', password='password')

   stdin, stdout, stderr = sshcon.exec_command(command)

   return stdout.read()

while True:

    i = 1
    while i <= 60:
        print "|------- Webserver2 -----------|"
        print time.ctime()
        response_time(desired_response_time, url2, webserver2, bilal2, local)
        list=ssh(bilal2, "xm list")
        if "webserver1" in list:
           horizontal('2')
           print "|------- Webserver1 -----------|"
           response_time(desired_response_time, url1, webserver1, bilal2, local)
        else:
             horizontal('1')
             pass
        time.sleep(5)
        i += 1

错误

^{pr2}$

Tags: hostparamikotimeresponse错误stdoutpasswordssh

热门问题