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
1.Have you used vxboot ? 2.Minimum requirement for mirror volume to created ?
How can the output be redirected to some other action process in place showing it in the screen?
What do you understand by mail aliases?
Tell me how to discover global zone name from local zone?
what is the importance of swap memory and how it will supports?
What is the login shell?
How can searches be refined?
How do you copy files from remote system using ftp?
Benefits of SMF compared LRC(legacy run control)?
Explain the types of installations in solaris
How can a user access a dos-format disk in solaris?
How to view shared memory statistics?
Tell me how to solve the system hung issue. Found that the memory state is free, commands to check and solve the issue?
Explain the vmstat output?
List out a few performance monitoring tools.