nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

How to create multiple user account?

This is a discussion on How to create multiple user account? within the Shell scripting forums, part of the Development/Scripting category; Task 1 – Automating account creation by using shell scripts. You have been asked by your boss to set up ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #11 (permalink)  
Old 07-04-2007, 04:06 PM
Junior Member
User
 
Join Date: Jul 2007
My distro: Suse Linux Enterprise Server 9
Posts: 1
Rep Power: 0
slayer_1988 is on a distinguished road
Default Creating multiple users in Suse Linux Enterprise Server 9

Task 1 – Automating account creation by using shell scripts.

You have been asked by your boss to set up 100 user accounts for your SLES9 Linux server. Each user account should have the following details:

Login name: userxx
Password: p@Ssxx
UID: 1900+xx
GID: 747 (name of group is IMFDelegate
Informational name: “Secret Agent xx
Home directory: /home/agentxx
Login shell: /bin/sh

For example, the first user will have the following details:
Login name: user00
Password: p@Ss00
UID: 1900
GID: 747
Informational name: “Secret Agent 00”
Home directory: /home/agent00
Login shell: /bin/sh

And for example, the last user will have the following details:
Login name: user99
Password: p@Ss99
UID: 1999
GID: 747
Informational name: “Secret Agent 99”
Home directory: /home/agent99
Login shell: /bin/sh

Notify your lecturer once you have successfully created the 100 user accounts. You will then be required to demonstrate the successful login of some randomly selected accounts.

Note: You will need to create a shell script to automate this task. You can make use of the groupadd and useradd scripts inside your shell script. You can also use the mkpass command to create the encrypted passwords.


Anyone can help me with this??Thanks
Reply With Quote
Sponsored Links
  #12 (permalink)  
Old 02-23-2008, 02:35 PM
Junior Member
User
 
Join Date: Feb 2008
My distro: RedHat
Posts: 1
Rep Power: 0
mahesh_nec is on a distinguished road
Default how to create multiple users in Fedora or RedHat

This example Written by Mahesh and Sathish on 23-02-2008 at Narasaraopet, will explain how to create multiple users using shell script.

####### file name : test.sh ##########
#author : mahesh & sathish
#date : 23-02-2008
#NARASARAOPET

uid="user"
i=1

#modify 50 to user required number and "student" to your choice group
number_of_users=50
mygroup="student"

groupadd $mygroup
while [ $i -le $number_of_users ]
do
useradd -g $mygroup $uid$i
sh pwd $uid$i
i=`expr $i + 1`
done

###### end of test.sh ########

#create one more file with the name pwd and give execute permissions


####### file name : pwd ##########
#author : mahesh & sathish
#date : 23-02-2008
#NARASARAOPET

passwd --stdin $1 <<end
$1123
$1123
end
##########end of pwd ############

#the above 2 programs creates 50 users as follows
#first user login-id : user1
#first user password : user1123
# ....
# ....
#50th user login-id : user50
#50th user password : user50123

#run the first program i.e test.sh ex: ./test.sh (give chmod +x test.sh)
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Unable to create user vaibhav.kanchan Getting started tutorials 3 12-07-2007 11:46 AM
how to create super user click007 Getting started tutorials 12 08-28-2007 09:14 PM
Create new user account in Ubuntu Linux from command line sweta Getting started tutorials 0 06-21-2007 02:49 AM
HP UX creating user account with SAM - it is easy to use rockdalinux HP-UX 0 12-20-2006 03:01 PM
how to create multiple file in a single command selvam Shell scripting 3 07-26-2006 02:01 AM


All times are GMT +5.5. The time now is 07:39 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36