title: RHEL 7 tim ALL=(root) NOPASSWD: /path-to-shell.sh is not working
body: <p>I have a Shell script which is owned by a particular user (<code>tim:tim</code>) and with permissions of <code>755</code>. For example, if the shell is <code>test.sh</code>, the output of <code>ls -la test.sh</code> gives:</p>
  
  <pre><code>-rwxr-xr-x 1 tim tim 27 Sep 10 01:03 test.sh
  </code></pre>
  
  <p>This shell has commands that should only be run by the <code>root</code> user. So what I need is, I need to run this shell script as <code>sudo test.sh</code> without prompting for the password. So I added the following entry at the <strong>end</strong> of the <code>/etc/sudoers</code> file.</p>
  
  <pre><code>tim ALL=(root) NOPASSWD: /path-to-shell/test.sh
  </code></pre>
  
  <p>But above is not working. It's still asking for the password. But when I add an entry as follows, it works without asking for the password.</p>
  
  <pre><code>tim ALL=(root) NOPASSWD: ALL
  </code></pre>
  
  <p>But what I want is, user <code>tim</code> should only have the privilege to execute <code>test.sh</code> (not all) without prompting for the password.</p>