2020
10-10
10-10
python ssh 执行shell命令的示例
#-*-coding:utf-8-*-importparamikoimportthreadingdefrun(host_ip,username,password,command):ssh=paramiko.SSHClient()try:ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())ssh.connect(host_ip,22,username,password)print('===================execon[%s]====================='%host_ip)stdin,stdout,stderr=ssh.exec_command(command,timeout=300)out=stdout...
继续阅读 >