title: Add a user to Ubuntu server from PHP script
body: <p>I am trying to write a PHP script which executes a shell command (via <code>system()</code>?) to add a new user to the server. I am thinking about using <code>useradd</code> or <code>adduser</code> but don't know how I will get it to work. What flags are necessary to execute <code>useradd</code> in a script? And how would I set the permissions on the script so it executes properly? This doesn't work:</p>
  
  <pre><code>&lt;?
  
  $user = $_GET['user'];
  
  system("sudo useradd -m -p 4dk/kBWvKaP52/POJYOZGLam8qZnCkQtdw== $user; echo $user");
  
  ?&gt;
  </code></pre>