I am trying to run two commands in root user. command_1 is running in root and command_2 is running outside root.
import paramiko
import sys
import os
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('hostname', username='username',password='password')
stdin, stdout, stderr = ssh.exec_command("sudo -i command_1 command_2")
output = stdout.read()
print output
I tried stdin, stdout, stderr = ssh.exec_command("sudo -i command_1;command_2") but no use.