Page 1 of 1

Importing Users

Posted: Tue Dec 19, 2006 6:28 pm
by Mouseclone
I have a text file that i have formated. Part of it came form my Imail server with an export tool. The basic layout is as follows:

First, Last, username, password

example

Mark, Pipkin, mpipkin, thisisnotmine

If i use omaddu

formated this way

omaddu -n 'Mark Pipkin/kauffmantire/IA="MarkPipkin" <mpipkin@kauffmantire.com> -p thisisnotmine

That works. Problem is that i have 150+ users. Not as many as most of you though, still a good bit.

If i do an AWK to get the formating to a file i get errors on some of the expressions. I'm new to awk, heck new to linux for the most part. Any way. I'm wondering if there is a utility to cat thought logs and get the users imported with passwords.

Thanks in advance

Posted: Tue Dec 19, 2006 9:58 pm
by btisdall
This should do the job:

#!/usr/bin/perl
#sxaddulist.pl - add users from a 4 column, comma-separated list
#Input format is first,last,username,password
#Usage: sxaddulist.pl /path/to/list

$mailnode = "mynode";
$omaddu = "/opt/scalix/bin/omaddu";
$domain = "domain.com";
while (<>) {
chomp;
next if /^#/;
($first,$last,$user,$pass) = split / *, */;
print ($first,"\n",$last,"\n",$user,"\n",$pass,"\n");
#system ("$omaddu -n \'$first $last/$mailnode/IA=\"$first $last\" <$user\@$domain>\' -p $pass $user");
}

Note you should do the first run with the 'system' line commented to check that your input list is parsed correctly, if all's well switch up the comments & do it. This script uses the supplied username as the scalix authid - if that's not what you want then delete the last '$user' from the command line & let Scalix auto-generate one instead.

Edit: added missing semicolon to line 12.

Posted: Wed Dec 20, 2006 10:08 am
by Mouseclone
Worked like a champ.. thank you. Problem is though I'm on the community edition. how do i make them all standard users... I'm going to get the enterprise edition or SBE. But just wanted to get the users installed and ready the server to make the switch. I looked at the --help of omaddu and didn't see to see one that was for standard user.

Sorry to the ignorance

**Edit

ok after digging around some more. Thanks for the man pages. It seems that i need to use the --class limited option. So i got it working. I need a few more edits it seems to get it right.. and the edits are to the user file itself.

thank you again for the help