Shun 发表于 2022-9-15 20:05:21

Linux vsftp vuer虚拟用户的创建批量脚本

#!/bin/sh
#Edit by mengbing
#DATE:20220914
#Usage:sh adduser_vuser.sh
echo -n "Enter the accout'snumber -> "
read number
expr $number + 10 > /dev/null 2>&1
status=$?

while[ "$status"!="0" ]
do
echo -n " You must input a number: "
read number
expr $number + 10 > /dev/null 2>&1
status=$?
done

counter=0
while [ $counter -lt $number ]
do
serial=`expr $counter + 1`
echo -n" Enter the $serialaccount name ->"
read NAME
echo -n" Enter the $serialaccount passwd ->"
read PASSWD
echo -n" RetypeEnter the $serialaccount passwd ->"
read PASSWD2
if [ $PASSWD = $PASSWD2 ]; then
echo $NAME >> /etc/vsftpd/ftpvuser
echo $PASSWD >> /etc/vsftpd/ftpvuser
db_load -T -t hash -f /etc/vsftpd/ftpvuser /etc/vsftpd/ftpvuser.db
cp /etc/vsftpd/vuser_dir/4MCT/etc/vsftpd/vuser_dir/$NAME
echo "Congratulation,The account $NAME is created success."
echo "Congratulation,The account $NAME is created success.The information is below.
USER:$NAME
PASSWORD:$PASSWD
Please Remember it.THX" |mail -s "DFS NEW ACCOUNT" mengbing@xx.com
else
echo "Sorry, passwords do not match. The account $NAME is not created."
exit
fi
counter=`expr $counter + 1`
done




http://blog.itpub.net/29551564/viewspace-2914683/
页: [1]
查看完整版本: Linux vsftp vuer虚拟用户的创建批量脚本