Files
MIXBOX-ARCHIVE/apps/vsftpd/config/mixbox.conf
2020-03-07 13:48:53 +08:00

68 lines
2.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#------------------【VsFtpd】-------------------
vsftpdAdd() {
read -p "请输入${appname}用户名:" user
[ "$user" = "root" ] && echo "不能添加root用户" && return 1
read -p "请输入${appname}密码:" passwd
read -p "请输入$user访问目录" path
if [ ! -z $user -a ! -z $passwd -a ! -z $path ]; then
sed -i "/$user/d" $FTPUSER
echo "$user,$passwd,$path" >> $FTPUSER
fi
read -p "添加完成,再添加一个?[1/0] " res
if checkread $res; then
[ "$res" == '1' ] && vsftpdAdd
fi
}
vsftpdDel() {
userlist=$(cat $FTPUSER | cut -d, -f1)
echo "${appname}用户[`echo $userlist`]"
read -p "请输入要删除的用户名:" res
[ ! -z "$res" ] && sed -i "/^$res,/d" $FTPUSER
read -p "删除完成,继续删除?[1/0] " res
if checkread $res; then
[ "$res" == '1' ] && vsftpdDel
fi
}
vsftpd() {
eval `mbdb export vsftpd`
source /etc/mixbox/bin/base
FTPUSER=${mbroot}/apps/vsftpd/config/ftpuser.conf
[ ! -f $FTPUSER ] && touch $FTPUSER
echo "********* $service ***********"
echo "[${appinfo}]"
readsh "启动${appname}服务[1/0] " "enable" "1"
if [ "$enable" == '1' ]; then
read -p "是否开启匿名用户访问?[1/0] " res
checkread $res && mbdb set $appname.main.anon_enable="$res"
if [ "$res" == '1' ]; then
anon_root=$(mbdb get ${appname}.main.anon_root)
[ -z $anon_root ] && anon_root="空"
read -p "更改匿名用户访问目录($anon_root)[1/0] " res
if [ "$res" == '1' ]; then
read -p "请输入匿名用户访问目录:" res
mbdb set $appname.main.anon_root="$res"
fi
fi
mbdb set $appname.main.ftp_port="21"
userlist=$(cat $FTPUSER | cut -d, -f1)
[ -z $userlist ] && userlist="空"
echo "${appname}用户[`echo $userlist`]"
read -p "添加${appname}用户?[1/0] " res
[ "$res" == '1' ] && vsftpdAdd
read -p "删除${appname}用户?[1/0] " res
[ "$res" == '1' ] && vsftpdDel
if [ "$(mbdb get entware.main.enable)" = '1' ]; then
readsh "使用entware安装插件程序[1/0]" "entware" "1"
# [ "$entware" = '1' ] && mv ${mbroot}/apps/${appname}/bin/${appname} ${mbroot}/apps/${appname}/bin/${appname}.bak &> /dev/null
fi
readsh "请输入${appname}外网访问配置[1/0]" "openport" "1"
${mbroot}/apps/${appname}/scripts/${appname}.sh restart
else
${mbroot}/apps/${appname}/scripts/${appname}.sh stop
fi
}
#------------------【VsFtpd】-------------------