title: Running commands as different user from bash script
body: <p>I have 2 users: usr1 and usr2. Neither is a root user.</p>
  
  <p>usr1 starts a bash script. And from the script, I want to run some commands as usr2.
  I understand that the way to do it is: </p>
  
  <pre><code>su -l &lt;usr2&gt; -c "command"
  </code></pre>
  
  <p>The issue is with passing the password. These are 2 different users with different privileges, so, skipping the password for usr2 is not an option. </p>
  
  <p>This script can go interactive, and ask the user for the password. Is there a way to do this in bash script ?</p>
  
  <p>Note: I am not an expert with scripting. And I have done some research before asking this question, but I couldnt find a suitable answer.</p>