Python ssh 远程执行shell命令
2021-07-10 15:07
标签:miss param client imp nbsp readlines add and tde Python ssh 远程执行shell命令 标签:miss param client imp nbsp readlines add and tde 原文地址:https://www.cnblogs.com/navysummer/p/9560739.html工具
python
paramiko
远程执行命令
import paramiko
ssh = paramiko.SSHClient()
key = paramiko.AutoAddPolicy()
ssh.set_missing_host_key_policy(key)
ssh.connect(‘127.0.0.1‘, 22, ‘user‘, ‘passwd‘ ,timeout=5)
stdin, stdout, stderr = ssh.exec_command(‘ls -l‘)
for i in stdout.readlines():
print(i)
文章标题:Python ssh 远程执行shell命令
文章链接:http://soscw.com/index.php/essay/103290.html