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 can be a reason for the solaris system slowing down? How can it be rectified?

571


How to view shared memory statistics?

547


Explain the difference between svm and vxvm?

539


In solaris 10 root Disk is 98% full what steps to be taken?

1667


What do you understand by irq assignments?

607






How can a user increase the number of pseudo-ttys? what is their use?

542


How to solve the system hang issue. Found that the memory state is free, commands to check and solve the issue?

582


What are the ways in which replication agreements between directory structures be arranged?

580


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

1752


How many run levels are there and what are they?

518


What causes the rpc.ttdbserverd process to be cpu bound?

549


Tell me how many types of file system?

657


How can a user access a dos-format disk in solaris?

554


Explain custom jumpstart procedure?

2498


How can a user login to another system on his network remotely?

547