Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-27-2007, 01:23 PM   #1
LQ Newbie
Registered: Feb 2007
Posts: 2

Rep: Reputation: 0
User Creation Bash

Ok i need to make a script for class that creats users and groups in a script.

so i made a text file called employ.txt

looks something like this:

John Doe jdoe IT
Mary Lamb mlamb Account

So, i need to make a script that creates the users jdoe, and mlamb using bash, and assigning them to there groups IT, or Account. anyone got any help or know a website i could look at one for some ideas?
Old 02-27-2007, 01:40 PM   #2
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
What kind of a class are we talking about? eg Have you had some basic instruction in scripts?

Go to and get "Bash Guide for Beginners" by Machtelt Garrels. Also there is something called Advanced BASH Scripting Guide (or something like that)
Old 02-27-2007, 01:46 PM   #3
LQ Newbie
Registered: Feb 2007
Posts: 2

Original Poster
Rep: Reputation: 0

its a linux system admin class and there really is no instructions, jus go out and find out how to do it.
this is what i got so far but it add everything in the text as users. i need to know were to put the awk for only the third field for users and awk user -g to assign them to the right groups.

for i in `more employ.txt `
echo $i
adduser $i

Last edited by WAIF; 02-27-2007 at 01:50 PM.


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
Bash: how to get time (in seconds) elapsed since creation of a file? J_Szucs Linux - General 6 12-27-2008 11:28 PM
File Creation: bash shell stapletone Linux - Newbie 2 09-24-2006 12:35 PM
User Creation in solaris siddhartha.das Solaris / OpenSolaris 3 03-05-2005 01:14 PM
Automatic user creation Skorpio Linux - Networking 3 09-25-2003 10:45 AM
GUI for new user creation coolamit78 Linux - Software 6 09-06-2003 04:36 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:08 AM.

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