Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 03-09-2005, 07:13 AM   #1
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:

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, 07:14 AM   #2
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, 10:15 PM   #3
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.

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.

cat ${NEW_USERS}|\
adduser ${USER} -c "${FNAME} ${LNAME}" -g ${WKAREA} -d /home/${WKAREA}/${USER} -p ${PASS}

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.

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.


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

All times are GMT -5. The time now is 12:02 PM.

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