title: Create linux user using php?
body: <p>I'm currently working on creating a member system for my FTP server for close friends that I want to have access to the server, however the FTP server that I'm using(proFTPd) utilizes the linux users as each member's account. So I need to use an html form with php of course that will have access to the server and be able to create a user on the system. </p>
  
  <p>Right now I have the form completely setup with it validating the email/username/password and saving it to my sql database. The only thing I'm missing is creating the new user to finish it out.</p>
  
  <p>I know it's not always the safest thing however I do want to do it and I do know the dangers so any help would be nice...</p>
  
  <p>As of right now from what I've always used to create a user on linux(or my version of Ubuntu atleast) it's: </p>
  
  <pre><code>useradd [username] -p [password] -d [/path_to_home_directory] -s [/bin/false]
  </code></pre>
  
  <p>without the brackets of course. </p>
  
  <p>I also know the php commands: shell_exec, exec, system() However I have tried each one of these with the line to create the user in it and nothing will work. </p>
  
  <p>I did a little more research and noticed that the webserver is running on www-data(which it should be) and it does not have access to the useradd command. So I 'viduso' it and still had no change.</p>
  
  <p>From what I've seen I can give the www-data access to a script on the server that will then create the user as root however I do not know how to transfer the variables stored in php to the script.</p>
  
  <p>If you need more details to help just ask. This is the last thing I need to finalize my last 2 month project which includes a desktop application and all that. It's so close but I can't seem to get it.</p>