标签:用户 anon perm enable bash mkdir 授权 gre write
#!/bin/bash
#2020-07-08
#vsftpd 服务虚拟用户管理脚本,可设置用户名,密码,及权限
read -p "请输入创建的账户: " user
read -p "请输入账户的密码: " passwd
read -p "请输入账户的权限: " permissions
vfile="/etc/vsftpd/user"
vdir="/etc/vsftpd/user_dir"
createuser () {
echo "$user" >> $vfile
echo "$passwd" >> $vfile
}
createhome () {
cat << END > $vdir/$user
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
END
}
grep -q "$user" $vfile
if [ $? -ne 0 ]
then
createuser
cd /etc/vsftpd
[ -d backup ] || mkdir backup
cp user.db backup/user.db-$(date ‘+%Y-%m-%d-%H:%M:%S‘)
db_load -T -t hash -f user user.db
[ -d $vdir ] || mkdir $vdir
if [ $permissions = ‘rw‘ ]
then
createhome
fi
else
echo "用户 $user 已经存在!"
fi
标签:用户 anon perm enable bash mkdir 授权 gre write
原文地址:https://www.cnblogs.com/linuxMA/p/13266088.html