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 ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
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 |
| Sponsored Links | ||
|
|
|
|||
|
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) |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| 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 |