On Mon, 22 Jan 2001, Gordon Rowell wrote:
> Create /home/e-smith/accounts - it's a text file. Create an account
> through the manager and then look at the entry created and make lots
> like that.
Better be a bit careful, since there is an existing /home/e-smith/accounts
file. So instead, create a file /home/e-smith/new-accounts file,
containing entries like:
johbp=user|City|Kingaroy|FirstName|Joh|Phone|15552323|ForwardAddress||\
EmailForward|local|Dept|BrownPaperBag|LastName|Bjelke-Peterson|\
PasswordSet|no|Company|Qld Inc|Corporation|Street|1 Easy Street
(but join the three lines together and remove the \s; you should be able
to create the file with a spreadsheet or database program).
> Then call:
>
> /sbin/e-smith/signal-event user-create {user}
>
> for each user in the file. The accounts will all be locked until the
> password is set by the administrator.
Then a program something like this will add all the accounts:
#! /usr/bin/perl -w
use esmith::config;
use esmith::util;
my %accounts;
tie %accounts, 'esmith::config', '/home/e-smith/accounts';
my %newaccounts;
tie %newaccounts, 'esmith::config', '/home/e-smith/newaccounts';
my $status = 0;
foreach my $user (keys %newaccounts)
{
$accounts{$user} = $newaccounts{$user};
if (system("/sbin/e-smith/signal-event", "user-create", $user) == 0)
{
delete $newaccounts{$user};
}
else
{
warn("error creating user $user\n");
$status++;
}
}
exit($status);
> Setting the password automatically is insecure as you have a plain text copy
> of the password stored, at least in the creation script. However, calls
> to esmith::util::setUserPassword($user, $password) will do what you want.
Add this code to the above if you want to set a default password. I agree
with Gordon - leave the accounts locked until real passwords are set under
supervision.
Good luck!
Charlie Brady [EMAIL PROTECTED]
http://www.e-smith.org (development) http://www.e-smith.com (corporate)
Phone: +1 (613) 368 4376 or 564 8000 Fax: +1 (613) 564 7739
e-smith, inc. 1500-150 Metcalfe St, Ottawa, ON K2P 1P1 Canada