Worst Php Code EVER!
Quote from reddit PHP
Creating a user from the web problem.
Go check out the comments!!!I have a form that creates a user by entering the username and their password. The code I'm using in php is:
I have used a whoami and have confirmed that it runs as http. In /etc/sudoers I have
shell_exec("sudo useradd -p $encpass -g groupname -s /bin/bash $username");
I also added http to group wheel. The problem I am having is it's not setting the password correctly. The user is created, just the password isn't set. I know that $encpass has a value because I can display it. I also know the command works because it runs fine in command line. This was working before, but I had to reinstall Arch Linux, so does anyone have an idea for why this doesn't work?
http ALL=(ALL) NOPASSWD: ALL root ALL=(ALL) ALL %wheel ALL=(ALL) NOPASSWD: ALL %sudo ALL=(ALL) ALL