paramiko

ssh = paramiko.SSHClient()  # 创建ssh对象
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname=ip, port=int(port), username=username, password=password, )
stdin, stdout, stderr = ssh.exec_command(cmd, timeout=10)
result = stdout.read()
result1 = result.decode()
error = stderr.read().decode('utf-8')
posted @ 2018-08-24 15:31  EngineTang  阅读(143)  评论(0编辑  收藏  举报