LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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-22-2005, 09:41 AM   #1
johnnyoi
LQ Newbie
 
Registered: Oct 2005
Posts: 4

Rep: Reputation: 0
BASH 1 script


hi all, does anyone know how to write a bash1 script that creates users, based on info from configuration files?

Or a link to a site with such information would be great.

Thank you,

John
 
Old 11-22-2005, 10:04 AM   #2
prabuayyappan
Member
 
Registered: Sep 2005
Location: Coimbatore
Distribution: Prabuayyappan
Posts: 32

Rep: Reputation: 15
which configuration file you mean.
 
Old 11-22-2005, 11:00 AM   #3
johnnyoi
LQ Newbie
 
Registered: Oct 2005
Posts: 4

Original Poster
Rep: Reputation: 0
just a plain text file that has usernames, passwords, and password policies.
 
Old 11-22-2005, 12:10 PM   #4
prabuayyappan
Member
 
Registered: Sep 2005
Location: Coimbatore
Distribution: Prabuayyappan
Posts: 32

Rep: Reputation: 15
here is a sample script
----------------user.conf -----------------
name:user1
passwd:user11
name:user2
passwd:user22

---------------------------useradd.sh-----------
#!/bin/bash
i=0
while read line
do
array[$i]=`echo $line | awk -F ":" '{print $2}'`
let i=$i+1
done < user.conf
for j in `seq 0 2 $(($i-1))`
do
/usr/sbin/useradd ${array[$j]} -p ${array[$(($j+1))]}
done
 
  


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
Bash Script zaicheke Programming 3 11-07-2004 07:32 PM
bash script how to? Lleb_KCir Programming 11 05-21-2004 08:03 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 01:20 AM
bash script - incrementing a filename in a script tslinux Programming 10 08-06-2003 12:58 AM
bash script prob: how can i tell the script that a 'dd' has finished? Frustin Linux - General 2 04-02-2003 06:34 AM


All times are GMT -5. The time now is 06:30 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