First of all, if this server is available on the 'net, it's a bad idea -
don't do it. If it is only accessable to your internal network, you have
less to worry about but you probably still do not want just anyone able to
add/change users.

That being said, you have a few options (I'd go with #3):
1- change the permissions on useradd and setquota (not a good idea)
2- authenticate the user on the webpage first, and then have the CGI do a su
- root useradd (better but not great)
3- collect the input from the webpage to a file and then have a root cron
job run periodically to read the data from the file, maybe do some checking
of the data (to see if the user exists, the address where they came from,
etc), and then perform the useradd from cron.

Actually, I'd probably go with a combination of #2 and #3 and have the
webpage do some basic authentication and then do #3.

My $0.02
-Pete


> -----Original Message-----
> From: Blakout @ hot [mailto:[EMAIL PROTECTED]]
> Sent: 26 December 2001 09:06
> To: [EMAIL PROTECTED]
> Subject: [Perl-unix-users] useradd vs. perl5.6 on Linux
> Importance: High
> 
> 
> Hi,
> 
> I'm trying to build CGI application that adds user to linux 
> users database and
> set quotas by:
> 
> system("$useradd -o -g users -d $userhome -m -c \"$FirstName 
> $Surname\" -p
> $Password $Nickname") || die "can't $useradd $Nickname: $!";
> system("$setquota / -u $block_soft $block_hard $inode_soft $inode_hard
> $Nickname") || die "can't $setquota $Nickname: $!";
> 
> I'm not getting desired effect because CGI scripts are 
> running as user apache
> and useradd and setquota can only been eun as root. What 
> shall  do to add users
> and manage their quota. Ideas highly appreciated.
> 
> Roman.
> 
> 
> 
> 
> _______________________________________________
> Perl-Unix-Users mailing list. To unsubscribe go to 
> http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users
> 
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to