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
What can be a reason for the solaris system slowing down? How can it be rectified?
How do you break the root password?
Explain how to view shared memory statistics?
How can threads be created in a solaris environment? Write an example
What is the login shell?
how to add your own run control script in server?
How can a user increase the number of pseudo-ttys?
Explain the types of installations in solaris
Tell me how to discover global zone name from local zone?
What is difference between swap -l & swap -s?
What can be done to protect the system from overflow exploits?
List out a few performance monitoring tools.
How can searches be refined?
What are nis daemons?
How can a user login to solaris? What is the login shell?