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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.