[wplug] add users via scripts

Chris vze2f6h6 at verizon.net
Wed Sep 17 16:54:36 EDT 2003


I know that is going to sound bad, but I can't think of any better
solutions.  I want to be able to add users to the system via a php page.
The problem that I am running into is how do I call/usr/sbin/useradd without
added the user "apache" to the root group.  Is it possible without leaving
the system wide open?  Oh, the next command that would be ran would be
/usr/sbin/usermod -s /sbin/nologin $user.  This is for adding mail only
users.  I can do it using shell scripting but only if I'm root.  Here are
the commands that I want to run.

/usr/sbin/useradd $user;
/bin/su $user -c "/var/qmail/bin/maildirmake ~/Maildir/";
/usr/sbin/usermod -s /sbin/nologin $user;
echo "$pass" | /usr/bin/passwd $user;
/bin/cp ./.qmail /home/$user/;

I will definitely be checking the input before passing it these commands.

Thanks,

Chris Romano




More information about the wplug mailing list