LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 07-11-2003, 09:26 PM   #1
k1e0x
LQ Newbie
 
Registered: Jul 2003
Posts: 7

Rep: Reputation: 0
adding 276 users


Ok I was able to convince my staff to replace there old exchange server with a Debian mail server. I have it up and running now and all is well, however I still need to add alot of users to the system before we switch over. I have now a execell spreadsheat that looks somewhat like this.

user1 pass1
user2 pass2
etc..

if I export that to a txt file. what is the easiest way to add those to the system? perl script maybe? is there a speical "Debian" way to go about it? what about adding user quotas, should I even worry about quotas?

thanks in advance.
 
Old 07-12-2003, 10:34 AM   #2
isme
LQ Newbie
 
Registered: Jul 2003
Posts: 12

Rep: Reputation: 0
you can make a shellscript to create the accounts.
here are some hints:

addgroup $user : to add the group
useradd -d /home/$user -g $user -m $user : to add the users, create home directories etc.
echo "$user:$password" | chpasswd : to make the passwords.

Of course, you need to script this a littlebit, to read $user and $password from your txt file.

Hope, that helps.
 
Old 07-12-2003, 01:21 PM   #3
k1e0x
LQ Newbie
 
Registered: Jul 2003
Posts: 7

Original Poster
Rep: Reputation: 0
yeah, thats likley what ill do. I was just wondering if there was a more Debian centric approach to it, like kernel-package or the pentium-builder types of packages..

or better yet sync it to a active directory server, that would be my ultimate solution.

Last edited by k1e0x; 07-12-2003 at 01:22 PM.
 
Old 08-07-2003, 04:29 PM   #4
k1e0x
LQ Newbie
 
Registered: Jul 2003
Posts: 7

Original Poster
Rep: Reputation: 0
here is the script I used to do this, I thought I would share it so other people didn't have to go through the trouble I did making it.

(the forum may eat the script's syntax)

#!/usr/bin/perl
# addusers script to be used on a SQL user database
# works with windows carrage returns ("^M")
# password,Lastname,Firstname

for $line (<>) {

# get password
$pw_end=index($line,",");
$pwd=substr($line,0,$pw_end);

# get lastname
$lname_start=index(($line,","))+1;
$lname_end=index($line,",",$lname_start);
$lname_width=$lname_end-$lname_start;
$lname=substr($line,$lname_start,$lname_width);

# get firstname
$fname_start=index($line,",",$lname_end)+1;
$fname=substr($line,$fname_start,(chomp($fname_start)+1));

$user=substr($fname,0,1).$lname;
$user="\L$user";

# build bash command
# UNHASH BELOW LINE TO MAKE SCRIPT LIVE
#system "bash command";

}
print "\nDone!\n";

Last edited by k1e0x; 08-07-2003 at 04:32 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
adding users rharris72 Programming 5 12-02-2005 05:51 PM
adding new users Brian Du Preez Linux - Newbie 1 10-04-2005 12:33 PM
adding users Lucasite Linux - Newbie 3 03-04-2004 11:30 AM
Mandrake 9.1 on Gigabyte 845PE-667 with Promise 276 RAID SKiB Linux - Newbie 0 09-01-2003 04:28 AM
adding Users hextex Linux - Newbie 5 06-08-2001 03:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 06:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration