I'm running a fairly simple program that lets users add an account onto my server so they can connect through ftp. The problem comes in in the following line (I left in the debug lines as well):
system("sudo /usr/sbin/useradd $username");
print "exit status: $?<br>\n";
print "errors: $!<br>\n";
The exit status is always 256, errors is always a "Bad file descriptor". In some fairly last ditch efforts to get this thing working, I've put chmod 777 on useradd and put the following line in my sudoers:
ALL ALL=(ALL) NOPASSWD: /usr/sbin/useradd
I'll fix these to be more secure after this thing gets sorted out. I've looked on google for a solution to this, but most people are having this problem with windows, and it's because they're actually opening files. I'm not opening any files, and running 'sudo /usr/sbin/useradd username' in a terminal works fine. Does anyone have any idea of what's wrong, or do I need to give more details?