title: how to run sudo command in paramiko module in python scripts in remote machine
body: <p>My scenario is I need to login to a remote machine and then do a sudo to another account like (<code>sudo su anotheract</code>) and then run the other required command.</p>
  
  <p>But I am able to successfully connect to remote machine using below script. But the scripts hangs in the line where I am executing the sudo command(<code>sudo su anotheract</code>)</p>
  
  <p>Can you please help me find the fix for this code?</p>
  
  <pre><code>import paramiko
  
  ssh = paramiko.SSHClient()
  
  ssh.set_missing_host_key_policy(
      paramiko.AutoAddPolicy())
  
  ssh.connect(hostname='XX.XXX.XX.XX',port=22, username='myname',password='XXXXX')
  
  ssh.exec_command=("sudo su anotheract")
  
  stdout,stdin,stderr=ssh.exec_command("java -jar /usr/share/XXX/LogR.jar")
  
  print stdout.readlines()
  </code></pre>