LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-13-2009, 02:28 AM   #1
glinuxo
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Rep: Reputation: 0
multiples users from text file scripted


hi

I am using this workaround maybe someone has a better a idea but this is What I am doing creating multiples users scripting


I got a text file name users

users text file
userid Description

Code:
mmaria Accounting Department
lana   Production Department
and I am using this script to create the users and assign a Description
but the command useradd is not doing anything not adding users neitehr description

Code:
while IFS= read -r l1 l2 l3
do
useradd -c "$l2 $l3" $l1
done <users
please some ideas

thanks a lot
 
Old 11-13-2009, 02:35 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,204
Blog Entries: 1

Rep: Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059
You can use the newusers command that is available in most linux distros

Regards
 
Old 11-13-2009, 02:52 AM   #3
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
it crux of the problem is not whether to use what tool. useradd is definitely the tool to use. The problem is your IFS=, remove it.
 
Old 11-13-2009, 06:23 AM   #4
glinuxo
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
You can use the newusers command that is available in most linux distros

Regards

I checked it
http://www.cyberciti.biz/tips/linux-...-in-batch.html

but what is default password for users?

I tried userid - password (linux terminal) and it won't work so it does not set the password?
 
Old 11-13-2009, 06:35 AM   #5
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
check the man page of useradd please!. the option for password is -p.
 
Old 11-13-2009, 06:36 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,204
Blog Entries: 1

Rep: Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059Reputation: 2059
Hi,
You have to create a txt file, where you give the password in clear text:
Code:
user1:password:400:101:Accounting Department:/home/user1:/bin/bash
user2:password:401:101:Accounting Department:/home/user2:/bin/bash
user3:password:402:101:Production Department:/home/user3:/bin/bash
 
Old 11-13-2009, 10:32 AM   #7
glinuxo
LQ Newbie
 
Registered: Nov 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ghostdog74 View Post
it crux of the problem is not whether to use what tool. useradd is definitely the tool to use. The problem is your IFS=, remove it.
if worked just fine

now I need to do the same with passwd and chage thanks a lot
 
  


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
How to parse text file to a set text column width and output to new text file? jsstevenson Programming 12 04-23-2008 02:36 PM
scripted scp when file size changes *CLI> Linux - Newbie 5 09-11-2007 01:45 PM
how to import users in qmail from text file Braytac Linux - Software 5 12-24-2006 09:43 AM
looking for simple scripted text-editing help win32sux General 2 10-29-2006 04:52 AM
Split large file into multiples jdozarchuk Linux - Newbie 1 11-04-2004 09:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:24 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
Open Source Consulting | Domain Registration