shell scripts to create 100 users


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers shell scripts to create 100 users
# 1  
Old 08-31-2001
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 05:18 PM..
# 2  
Old 08-31-2001
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-03-2001
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
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
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
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.
# 7  
Old 09-06-2001
Hi Folks

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

regards
Hrishy
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script to filter users and create them again from a back-up server

This is a script to filter the users out of etc/passwd and etc/group. So if you want to migrate of restore a server you can use this script from a backup to restore and make the same users on you had.. Please feedback and comments. #!/bin/bash prompt_list () { # haal uit de argumenten de... (5 Replies)
Discussion started by: dannyvdberg
5 Replies

2. Shell Programming and Scripting

Create multiple users with individual passwords to users

hi, i am new to shell scripts i write a shell script to create multiple users but i need to give passwords to that users while creating users, command to write this script (1 Reply)
Discussion started by: DONFOX
1 Replies

3. Shell Programming and Scripting

How I can create this Shell scripts?

Hi friends you can solve my question about make 3 shell scripts? Thanks for all! (1 Reply)
Discussion started by: dakota
1 Replies

4. UNIX for Dummies Questions & Answers

shell scripts - list dead users accts and include a count at the end?

I am trying to show the number of dead accts or false shells running and include a count at the end. Does anyone know how to go about this? Thanks - citizencro (3 Replies)
Discussion started by: citizencro
3 Replies

5. UNIX for Dummies Questions & Answers

shell scripts - create a filename with the date appended

I am looking to do something where if I created a file named backup,or whatever it would print a name like “backup_Apr_11_2011”. Thanks citizencro (1 Reply)
Discussion started by: citizencro
1 Replies

6. Shell Programming and Scripting

Create Bash shell scripts corresponding to windows bat files

Experts, I am newbie in shell scripting. I want to write Bash shell scripts corresponding to windows bat files. I have installed cygwin at c:\cygwin and i am trying to crate the sh file using vi editor. i am not able to understand how to use linux/unix convention for the code. following is my... (1 Reply)
Discussion started by: rajuchacha007
1 Replies

7. Shell Programming and Scripting

how to create and remove desktop icons from shell scripts

hi all how to create and remove desktop icons or icons from shell scripts? (1 Reply)
Discussion started by: kkpal
1 Replies

8. OS X (Apple)

interactive shell script to create users 10.4

Hello everyone, Not sure if this is the right place, but OS X isn't your standard Unix, so I figured here would be best. I am looking at creating a script that will be interactive that admins can run to create users. Now, 10.4 uses netinfo database and netinfo manager to handle it's users. ... (3 Replies)
Discussion started by: tlarkin
3 Replies

9. UNIX for Dummies Questions & Answers

Scripts and changing users

Hi, I am writing somescripts to shut down some services in Korn Shell. Some of the services are under different owners. For example when I want to shutdown NXserver I need to be "root", but when I shut down the webserver I need to be under a different user. Manual I would use "su root" and... (1 Reply)
Discussion started by: bonekrusher
1 Replies

10. Shell Programming and Scripting

FTP is using shell scripts create ? for file

ftp -n -v <<EOF verbose open 3.57.40.79 user infodvlp pr0gram ascii lcd /home/a501420038/GLA/Success_Load/ cd /ftp/SrcFiles/csg/InstruAsia/ get AU_Success_Log.txt close quit EOF Please help on this, this gives the out put "AU_Success_Log.txt?" As question mark in the last what will... (1 Reply)
Discussion started by: a501420038
1 Replies
Login or Register to Ask a Question