title: unix - run a command as another user
body: <p>I am a newbie to Unix. I am trying to run a shell script and command as another user.</p>
  
  <p>For example:
  I am logged in as user1 and want to execute a script as user2. I dont want the password prompt and I want it to be auto-entered. I am aware of the public key authentication but I am trying to find if there is something like:</p>
  
  <pre><code>sudo -u user2 script.sh
  </code></pre>
  
  <p>I am trying to cron this, so I dont want the password prompt. I want it to be handled in the sudo command itself.</p>
  
  <p>please help</p>