how to create 100 users at a time in solaris?

Answer Posted / satish

#!/bin/ksh

#
# Adds users from the userlist.txt file if they are not in
# /etc/passwd.
#

CURRENTUSERS=`awk -F":" '{ print $1 }' /etc/passwd`
EXPECTEDUSERS=`cat userlist.txt`
USERFOUND=0

for i in $EXPECTEDUSERS ; do
for x in $CURRENTUSERS ; do
if [ "$x" = "$i" ] ; then
USERFOUND=1
fi
done
if [ $USERFOUND -eq 1 ] ; then
echo Found user: $i
USERFOUND=0
else
/usr/sbin/useradd -d /home/$i -g wheel $i
echo Adding user: $i
sed s/$i:.*:.*:.*:.*:.*:.*:.*:/$i:XOHWcSkDQKZaA:14208:0:99999:7:::/g </etc/shadow>/etc/shadow2
cp /etc/shadow2 /etc/shadow
rm /etc/shadow2
fi
done

exit 0

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are nis daemons?

562


Explain the types of installations in solaris

570


How can a user login to solaris?

566


environment? Is it heterogeneous (mix of linux, solaris,other UNIX)?

1749


Benefits of SMF compared LRC(legacy run control)?

2573






Explain the vmstat output?

541


1.Have you used vxboot ? 2.Minimum requirement for mirror volume to created ?

1713


How can a user login to solaris? What is the login shell?

564


What causes the rpc.ttdbserverd process to be cpu bound? How can it be rectified?

529


Tell me how to mount the floppy & cd-rom?

531


Tell me how to discover global zone name from local zone?

526


Suppose I have 20 gb free space in my file system but my inode size full. How will I increase or how will I fix this issue?

594


How can a user increase the number of pseudo-ttys?

569


How to view shared memory statistics?

547


How can the output be redirected to some other action process in place showing it in the screen?

565