Adding nologin users from a PHP form
Posted: Wed Aug 16, 2006 5:51 am
At the moment I have a very unexperienced bit of code, which doesn't actually work, well
I use a HTML form to post a variable of the username from a form input to the PHP document. I used the shell_exec command to run 'useradd -s /sbin/nologin'.
I get the "user created" message on the PHP form, but it doesn't actually create a user.
My query isn't actually to get this working, it's to find a more efficiant way to perform this task.
Regards, Stephen
Code: Select all
<?php
$inputUser = $_REQUEST["user"];
$shellCmdUsername = shell_exec('useradd -s /sbin/nologin $inputUser');
print "$shellCmdUsername";
print "Username $inputUser created<br>";
?>My query isn't actually to get this working, it's to find a more efficiant way to perform this task.
Regards, Stephen