Adding a user (useradd) via PHP - Ubuntu
I am trying to add a user to the server in a PHP script, however it's not working.
Here is my code:
$user = $_GET['user'];
system("sudo useradd -m -p 4dk/kBWvKaP5开发者_如何学JAVA2/POJYOZGLam8qZnCkQtdw== $user; echo $user");
Yes, I know how dangerous this is.
You can set the setuid
bit on the script file and chown
it to root so it runs as root, e.g. chmod u+s file.php
.
精彩评论