grep -v ^chmod /etc/ftpaccess |grep -v ^delete |grep -v ^rename |grep -v ^overwrite > /etc/ftpaccess.tmp
mv -f /etc/ftpaccess.tmp /etc/ftpaccess
echo -e "\nchmod\t\tno\tguest,anonymous" >> /etc/ftpaccess
echo -e "delete\t\tno\tanonymous" >> /etc/ftpaccess
echo -e "overwrite\tno\tanonymous" >> /etc/ftpaccess
echo -e "rename\t\tno\tanonymous" >> /etc/ftpaccess
echo -e "rename\t\tyes\treal\n" >> /etc/ftpaccess
grep -v ^noretrieve /etc/ftpaccess > /etc/ftpaccess.tmp
mv -f /etc/ftpaccess.tmp /etc/ftpaccess
echo -e "\nnoretrieve\t/home/ftp/upload" >> /etc/ftpaccess
# echo -e "noretrieve\t/home/ftp/dev" >> /etc/ftpaccess
# echo -e "noretrieve\t/home/ftp/lib" >> /etc/ftpaccess
# echo -e "noretrieve\t/home/ftp/bin\n" >> /etc/ftpaccess
echo "You couldn't download files from directory /home/ftp/upload !"
grep -v ^guest-root /etc/ftpaccess |grep -v ^restricted-gid |grep -v ^restricted-uid > /etc/ftpaccess.tmp
mv -f /etc/ftpaccess.tmp /etc/ftpaccess
echo -e "\nguest-root\t/home/ftp\tftpadmin" >> /etc/ftpaccess
echo -e "restricted-uid\tftpadmin" >>/etc/ftpaccess
echo -e "restricted-gid\tftpadmin\n" >>/etc/ftpaccess
}
message(){
class_defined
grep -v ^message /etc/ftpaccess |grep -v ^readme |grep -v ^greeting >/etc/ftpaccess.tmp
mv -f /etc/ftpaccess.tmp /etc/ftpaccess
echo -e "\nThis is MESSAGE TEST ,if you see the information ,congratulations !\n" >/home/ftp/.welcome.msg
echo -e "\nmessage\t/home/ftp/.welcome.msg\tLOGIN" >> /etc/ftpaccess
echo -e "\nThis is README TEST ,if you see the information ,congratulations !\n" > /home/ftp/README.txt
echo -e "readme\treadme\tREADME*\tlogin" >> /etc/ftpaccess
echo -e "readme\tREADME*\tcwd=*" >> /etc/ftpaccess
echo -e "greeting\tterse\n" >> /etc/ftpaccess
echo -e "Only "FTP server ready" echo when connected !"
}
security(){
class_defined
grep -v commands /etc/ftpaccess |grep -v transfers |grep -v security |grep -v ^passwd_check > /etc/ftpaccess.tmp
mv -f /etc/ftpaccess.tmp /etc/ftpaccess
echo -e "\nlog\tcommands\treal,guest" >> /etc/ftpaccess
echo -e "log\ttransfers\treal,guest\tinbound,outbound" >> /etc/ftpaccess
echo "Commands used by real users and guest users loged to /var/log/message !"
echo -e "passwd-check\trfc822\tenforce" >> /etc/ftpaccess
echo "If the password isn't the rfc822 email address,you will not login in !"
}
guest(){
class_defined
if [ $arg_count -ne 2 ] ; then
echo -e "\007\nUsage: $0 guest username !\n"
exit 1
fi
if [ `grep -c ^$username /etc/passwd` -lt 1 ] ; then
echo -e "\007The user $username does not exist.\nPlease run $0 userconf first !"
exit 1
fi
if [ `grep ^guestgroup /etc/ftpaccess |grep -c $username` -ge 1 ] ; then
echo -e "\007\nUser $username does exist in guestgroup !\nTry another user"
else
echo -e "\nguestgroup\t$username" >> /etc/ftpaccess
echo -e "User $username added to guestgroup !"
fi
}
denyuser(){
if [ $arg_count -ne 3 ] ; then
echo -e "\n\007Usage: $0 denyuser add/del username !\n"
exit 1
fi
if [ -f /etc/ftpusers ] ; then
echo -e "\nDeny-userlist file ready !"
else
echo "Deny-userlist file not found !"
touch /etc/ftpusers
chmod 0600 /etc/ftpusers
echo "Create it(/etc/ftpusers) succeed !"
fi
if [ `grep -c ^$username /etc/passwd` -lt 1 ] ; then
echo -e "\007\nThe user $username does not exist.\nPlease run $0 userconf first !"
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




