[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cobalt-users] Mail only User Auto-script !
- Subject: [cobalt-users] Mail only User Auto-script !
- From: InterVision <dannyf@xxxxxxxxxxx>
- Date: Sun Apr 2 11:01:07 2000
Hi,
I'm writeing script for adding mail users only, and users can register
theself or the admin can (if the admin create the open.me file or other
script that add's info from a FORM)
P/s : sorry for my english.
I attach the source of it, you can try to use it , but please tell me what
do you think, and where is the problems ??
this source is the source of script i called: addme.cgi and copied it to:
/etc/cron.half-hourly
========== (c) InterVision :: Danny Shtainberg =====
#!/usr/bin/perl
use Cobalt::Product; # Loads paths, standard variables
use Cobalt::User; # Loads user-specific functions
open (INF, "/home/sites/home/open.me") ;
@datafile = <INF> ;
close (INF) ;
foreach $i (@datafile) {
chomp ($i) ;
($user, $pass, $email) = split (/\|/, $i) ;
$salt1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./';
$salt = substr($salt1,rand(length($salt1)),1);
$salt .= substr($salt1,rand(length($salt1)),1);
$newpass = crypt($pass,$salt);
$uid= Cobalt::User::user_get_first_available_uid(1000);
open (PASSWD, ">>/etc/passwd") ;
print PASSWD "$user:x:$uid:100:Mail User:/noftp:/bin/badsh\n";
close (PASSWD) ;
print "PASSWD ADD: $user:x:$uid:100:Mail User:/noftp:/bin/badsh";
open (SH, ">>/etc/shadow") ;
print SH "$user:$newpass:11039:0:99999:7:::\n";
close (SH) ;
print "SHDOW ADD: $user:$newpass:11039:0:99999:7:::";
open (VT, ">>/etc/virtusertable") ;
print VT "$email $user\n";
close (VT) ;
print "VT ADD: $email $user";
=============THE END ==============
Thank you,
Danny
}