The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to create users on HP UX???? mascotlee UNIX Desktop for Dummies Questions & Answers 8 07-20-2008 11:02 PM
interactive shell script to create users 10.4 tlarkin OS X (Apple) 3 03-27-2008 12:35 PM
create users from template rijeshpp Shell Programming and Scripting 0 10-31-2007 07:29 AM
FTP is using shell scripts create ? for file a501420038 Shell Programming and Scripting 1 08-16-2007 11:39 AM
How do I create desktop icons for the shell programs I create??? TRUEST UNIX Desktop for Dummies Questions & Answers 7 05-15-2002 08:40 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 08-31-2001
Registered User
 

Join Date: Aug 2001
Posts: 58
shell scripts to create 100 users

Hello

i need a shell script to create 100 users i am running hp-ux.........

startegy is something like this

craete a shell script
Code:
!/bin/ksh
counter=1
while [ $counter .le. 100 ] 
do
{
   useradd usr$counter
   passwd usr$counter
# here begins my problem when i say passwd usr$counter
#it again prompts saying retype new passwd..how do i handle #this situation
   counter=counter+1
}
done
regards
hrishy

added code tags for readability --oombera

Last edited by oombera; 02-19-2004 at 02:18 PM.
Forum Sponsor
  #2  
Old 08-31-2001
mib mib is offline
Registered User
 

Join Date: Jan 2001
Location: Calicut
Posts: 228
Use Expect. Expect is a tool for automating interactive applications such as telnet, ftp, passwd, fsck, rlogin, etc.
It is not default Unix tool(newest Linux distributions Contains Expect)

you can download expect from:

http://expect.nist.gov/


  #3  
Old 09-02-2001
Registered User
 

Join Date: Aug 2001
Posts: 58
Hello Mib

I am aware of expect .........but i would like to do it thru a shell script.could you let me know how?

regards
hrishy
  #4  
Old 09-03-2001
mib mib is offline
Registered User
 

Join Date: Jan 2001
Location: Calicut
Posts: 228
I afraid I can't help you on that. May be someone else.

If you consider Perl, there is nice modules available for manipulating the passwd and shadow files. Such as:
Unix::PasswdFile - Perl interface to /etc/passwd format files

Passwd::Linux - Perl module for manipulating the passwd and shadow files

These modules are available here. http://search.cpan.org/
  #5  
Old 09-04-2001
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
in a file type out all the usernames you want. one per line The password portion i am lost on. sorry.

USERLIST=/path/to/your/list
for i in `cat $USERLIST`;do
useradd ...........
done
  #6  
Old 09-04-2001
patvdv's Avatar
Registered User
 

Join Date: Jul 2001
Location: Belgium
Posts: 83
Fixed Line

The easiest to circumvent the password thingy to is to paste lines into the /etc/passwd with a fixed string for the password (using a known 'default' password). Then you run a passwd -f afterwards for the user that he/she is forced to change password at first login.
__________________
Patrick Van der Veken - UNIX consultant (c) 2001 - 2001 http://www.baanboard.com - http://www.ux-core.com
'True strength lies in gentleness' - Irish proverb
  #7  
Old 09-06-2001
Registered User
 

Join Date: Aug 2001
Posts: 58
Hi Folks

i ma glad that i was able to come with a solution .tahnkx for helping me out folks.

regards
Hrishy
Google The UNIX and Linux Forums
Closed Thread

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0