############################################################# # userdupe - Duplicate user IDs from another machine # AIX specific # J. David Schronce - 02 Oct 2007 ############################################################# # Variable Definitions # inputfile - a copy of /etc/password from the SOURCE # system, filtered for only the accounts you want to create # # outputfile - the name of the script that will be created to # actually create the accounts ############################################################## inputfile=userlist outputfile=run_as_root.sh ############################################################## # End of Variable Definitions ############################################################## # Clear output file cp /dev/null $outputfile # count inputfile filecount=`cat $inputfile | wc -l` filecount=`echo "$filecount +0" | bc` linecount=0 # Create user entries in outputfile cat $inputfile | while read pwline; do linecount=`echo "$linecount +1" | bc` # Parse fields LOGIN=`echo "$pwline" | cut -d: -f1` ID=`echo "$pwline" | cut -d: -f3` GECOS=`echo "$pwline" | cut -d: -f5` HOME=`echo "$pwline" | cut -d: -f6` SHELL=`echo "$pwline" | cut -d: -f7` echo "$linecount of $filecount : $LOGIN $GECOS" # Next line should be all on one line through ">> $outputfile" echo "mkuser id='$ID' pgrp='lawson' groups='lawson' home='$HOME' shell='$SHELL' gecos='$GECOS' $LOGIN" >> $outputfile done chmod 777 $outputfile echo "\n Complete..." echo "\nHave 'root' user execute $outputfile to create new accounts\n"