title: How to execute a command on behalf of a user if login is denied
body: <p>I need to run tomcat on behalf of <code>tomcat</code> user. But in <code>/etc/passwd</code> I have the following line:</p>
  
  <pre><code>tomcat:x:505:506::/usr/share/tomcat:/bin/nologin
  </code></pre>
  
  <p>So when I try to do this: <code>sudo su tomcat ./bin/startup.sh</code></p>
  
  <p>It complains about: <code>su: /bin/nologin: No such file or directory</code></p>
  
  <p>How do I execute the command with proper permissions? </p>
  
  <p>Thanks in advance!</p>
  
  <p>P.S. I'm trying to reverse engineer the configuration and it's production. So I have to be delicate...</p>