I run a virtual hosting environment. I have a perl(CGI) control panel which runs over SSL with htaccess. The control panel let's users modify their email handlers (forwards and stuff). I've added the ability for a user to add another user to the system so the virtual host can add their own mailboxes. Each new user added is the username with a number at the end. After i gather my new user data, i pass a request from the CGI to a root perl script (called root.pl). The root script is controlled by cron. After a series of checks, root.pl adds the user to the system by running useradd. Or at least it tries. I am only getting errors when cron runs the root.pl. If i run root.pl from ssh manually it adds the user returning '0' to my log. When i let cron execute root.pl. The user is not added and i get the error 65280 returned.
Here's what root.pl does to add the user.
#!/usr/bin/perl
use strict;
use Crypt::Passwd;
my $home = "/var/www/grpname/";
my $user = "User23";
my $password = "xR3rts";
my $grp = "grpname";
my $cpass = unix_std_crypt($password, "salt");
my $re = system("useradd -g $grp -p $cpass -d $home $user");
print "ADDUSER:$re\n";
exit;
I know it is running as root with cron b/c i've tested with:
my $real = getpwuid($<);
my $effective = getpwuid($>);
Both return root to my log whether running from cron or manually with ssh. I've looked for the error 65280 with no luck.
Any ideas as to why im getting 65280 error when cron tries? Thanks for reading.
jtrue