Multiple User Creation using Shell Script
vi user.txt
u1
u2
u3
u4
u5
u6
u7
u8
u9
u10
u11
u12
u13
u14
u15
Above 15 users been saved to text file user.txt
Creating Script adduser with below lines
for i in `cat user.txt`
do
useradd -c $i -d /home/exam/$i -g users $i
done
Changing permission
for i in `cat examusers-400-600`
do
echo "chmod 000 /home/exam/$i"
chmod 000 /home/exam/$i
#chmod 700 /home/exam/$i
done
Giving Permission
x=1
while [ $x -le 600 ]
do
echo /home/exam/u$x
chmod 755 /home/exam/u$x
let x=$x+1
done
Deleting files and folder :
x=1
while [ $x -le 600 ]
do
echo /home/exam/u$x
rm -rf /home/exam/u$x/*
let x=$x+1
done