Jun 132010
 

From blog.amit-agarwal.co.in


cat < login.sh
for i in `cat logins` ; do
login=`echo “$i”|awk -F”:” ‘{print $2}’`;
comment=”`echo “$i”|awk -F”:” ‘{print $1}’`”;
gr=”`echo “$i”|awk -F”:” ‘{print $3}’`”;
echo “login –>> $login –Comment –>> $comment –Group –>>$gr –”;
echo “useradd -c ”$comment” -d /export/home/$login -m -g $gr -s /bin/bash $login”
useradd -c “$comment” -d /export/home/$login -m -g $gr -s /bin/bash $login
done

You will need to create a file called logins to store the comment, login name and the group. The group must be created first. Here is an example of the file:

cat logins
Amit Agarwal:amitag:test

 Posted by at 6:11 am