LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-09-2005, 06:13 AM   #1
collern2
LQ Newbie
 
Registered: Mar 2005
Posts: 24

Rep: Reputation: 15
Creating Multiple user accounts from a formatted file


Hi, I've a formatted file in the form:

Name:Password:Work:Area
Joe Black:leu2dsfr:test
Jack White:Xahsei6i:finance

I'm wondering how I create multiple user accounts form this formatted file? Is it possible to remove multiple user accounts in the same manner?
 
Old 03-09-2005, 06:14 AM   #2
collern2
LQ Newbie
 
Registered: Mar 2005
Posts: 24

Original Poster
Rep: Reputation: 15
Sorry the formatted file is in this manner:

Name:Password:Work Area
Joe Black:leu2dsfr:test
Jack White:Xahsei6i:finance
 
Old 03-09-2005, 09:15 PM   #3
MichaelP
Member
 
Registered: Jul 2004
Location: Dominica
Distribution: CentOS
Posts: 35

Rep: Reputation: 15
I am new to linux but i started with admin work and setting up a samba server for 500 users.
I got the basics of this script from this site, i think, and edited it to suit me.

1. Created the groups that i wanted
2. Created Home and subHome directories eg. /home/finance /home/accounts
3. Created a .csv file from OOo or Excel with the seperator being SPACE not Comma. By WORK AREA I assume you mean UNIX GROUP. I put the names file in the /home dir hence the "/home/names" in the script.

USER FNAME LNAME PASS WKAREA
joeb Joe Black leu2dsfr test
jackw Jack White Xahsei6i finance

4. Created the script below. call it addusers or what ever you want. save it in /home or where ever you want.

#!/bin/bash
NEW_USERS="/home/names"
cat ${NEW_USERS}|\
while read USER FNAME LNAME PASS WKAREA
do
adduser ${USER} -c "${FNAME} ${LNAME}" -g ${WKAREA} -d /home/${WKAREA}/${USER} -p ${PASS}
done

5. open terminal and cd to the directory where the script is

~ bash addusers

I did not use the password part because i was setting up samba users not unix users. Users had to log on to samba server (linux) from a Win98 PC, but i believe that is how the password should be entered. Not too sure of the confirm password request will work. If it doesn't try without the -p in the script

Test with just one or two users. If the script runs ok and the user and directories created, logoff and login to test the password part.

Remember:
I used Fedora 2 for this,
you may need to try adduser or useradd,
need to be root - not too sure if su will work.
I did this some while ago and I am trying to remember and be as clear as i can. Change to suite your needs.

This site has helped me so very much that if i think i might be able to help i will offer. I am NO EXPERT.
EXERCISE CAUTION
 
  


Reply



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
trouble creating user accounts krsnachaitanya Linux - Networking 2 02-12-2005 10:01 AM
difficulties with creating user accounts, which is the best tool paragon17 Linux - General 6 02-29-2004 12:43 PM
Creating multiple POP3 accounts jobokoth Linux - General 1 10-04-2003 09:06 AM
Creating User Accounts Winux Linux - Newbie 6 04-01-2003 05:35 AM
Creating user accounts Ricardo Linux - Newbie 3 05-19-2002 03:24 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:39 AM.

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
Open Source Consulting | Domain Registration