title: Permission Denied on UserAdd command shell script started by PHP exec
body: <p>I've a PHP exec command which starts a bash script in Linux Centos 7.2</p>
  
  <pre><code>#!/bin/sh
  # \
  mkdir /var/www/html/folder1/$1
  
  useradd -g usergroup -d /var/www/html/folder1/$1 $1
  </code></pre>
  
  <p>The sudoers is configured this way. 'apache' is the Apache User and Group in my installation:</p>
  
  <pre><code>apache    ALL=(ALL) ALL
  apache ALL=(ALL) NOPASSWD: /usr/sbin/useradd
  </code></pre>
  
  <p>The mkdir command works as expected.
  But the useradd command retrieves a 'permission denied' error even if I explicitly decleared in sudoers that the group/user apache has permission to execute useradd.</p>
  
  <p>So How to solve this ? How to create a user which belongs to an already defined usergroup without getting 'permission denied' ?</p>