title: How to run a file by another user in python Subprocess
body: <p>I am creating a python script which calls a shell script and run that shell script on a terminal using <code>Subprocess</code> . My problem is that I want to run that shell script by another user . My code is Given below</p>
  <p><strong>Code:</strong></p>
  <pre><code>import subprocess
  filename = '/mount/test.sh'
  p = subprocess.Popen([filename],shell=True,stdout=subprocess.PIPE)
  out, err = p.communicate()
  print(out)
  </code></pre>
  <p>Can anyone tell me that how to run my shell script by another user ?</p>
  <blockquote>
  <p>Note:</p>
  <p>Only the subprocess part should be run by another user, not the main python script</p>
  </blockquote>