![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
hrishy added code tags for readability --oombera Last edited by oombera; 02-19-2004 at 02:18 PM. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
|||
|
|||
|
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 |