工具
python
paramiko
远程执行命令
代码语言:javascript复制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)