#!/bin/sh
#Name:smbadd
#Des:To add some samba user
#Author:PopZslam
_PASSWD=****** #You can defined it youself.
_SMBNAME=user
_SMBGROUP=users #Sorry, I forget the samba group's name.You can edit this script and input the currect name.
_SMBSHELL=/bin/null #Defined user's shell
MyAdd ()
{
adduser $_SMBNAME -g $_SMBGROUP -s $_SMBSHELL
echo "The smbuser" $_SMBNAME "is added to "$_SMBGROUP!
echo "Set password for smbuser"
echo $_PASSWD|passwd $_SMBNAME --stdin
}
USERLIST ()
{
if [ -f ~/smbuserlist ] ; then
i=1
while
_NUM=`head -n $i ~/smbuserlist|awk '$1==i {printf "%s",$1;next;}' i="$i"`
do
if [ -z $_NUM ] ; then
echo "There is no user to add!!"
exit 0
else
_SMBNAME=`awk '$1==i {printf "%s",$2;next;}' i="$i" ~/smbuserlist`
MyAdd
i=`expr $i + 1`
fi
done
else
echo "You Must create a file named \"smbuserlist\" first!"
fi
}