Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mkuser script 1

Status
Not open for further replies.

thepallace

Technical User
Jun 8, 2004
48
US
Is anyone has a script to add user on a AIX box. I need to add 50+ users. smitty would take time to accomplish this.

Thanks,
JA
 
Assuming these users are going to have much in common, you can do the following:

smitty -s mkuser.script -x mkuser

When started with these flags, smitty will log any scripts it would execute to the file mkuser.script, but will not actually execute them.

Input the information for one of your fifty users into the smitty screen, hit <ENTER>, and then exit from the screen telling you that the command has been logged. The mkuser.script file will now contain something like this:

Code:
#
#     [Jun 08 2004, 14:15:42]
#
x() {
LIST=
SET_A=
for i in "$@"
do
        if [ "$i" = "admin=true" ]
        then
                SET_A="-a"
                continue
        fi
        LIST="$LIST \"$i\""
done
eval mkuser $SET_A $LIST
}
x pgrp='users' groups='users,printq' home='/home/users/testuser' shell='/bin/ksh' gecos='Test User' testuser

Pop into an editor, copy and modify the last line appropriately for the other 49 (or do it programmatically if you have a source file with the variable information already), and execute with:

ksh mkuser.script

This technique is handy for creating skeletons of scripts for all sorts of administrative functions.

Rod Knowlton
IBM Certified Advanced Technical Expert pSeries and AIX 5L

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top