扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
在本页阅读全文(共2页)
# To prevent DoSattacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances 30
# Set the user and group under which the server will run.
User FTPUSR
Group FTPGRP
# Normally, we want files to be overwriteable.
AllowOverwrite on
# A basic anonymous configuration, no upload directories.
# 匿名登录设置。匿名用户目录为/ftp
User ftp
Group ftpusers
# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp
# Limit the maximum number of anonymous logins
MaxClients 10
# We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
DisplayLogin welcome.msg
DisplayFirstChdir .message
# Limit WRITE everywhere in the anonymous chroot
#
# DenyAll
#
# 数据库联接的信息,FTP是数据库名,localhost是主机名,root是连接数据库的用户名,#123456是密码
# 数据库认证的类型
SQLAuthTypes Backend Plaintext
# 指定用来做用户认证的表的有关信息。("FTPUSERS"和"FTPGRPS"是数据表名字,等一会
# 在下面建立)
SQLUserInfo FTPUSERS userid passwd uid gid homedir shell
SQLGroupInfo FTPGRPS groupname gid members
# 数据库的鉴别
SQLAuthenticate users groups usersetfast groupsetfast
# 如果home目录不存在,则系统会根据它的home项新建一个目录
SQLHomedirOnDemand on
# 启用磁盘限额
QuotaDirectoryTally on
# 磁盘限额单位 b"|"Kb"|"Mb"|"Gb"
QuotaDisplayUnits "Kb"
QuotaEngine on
# 磁盘限额日志记录
QuotaLog "/var/log"
# 打开磁盘限额信息,当登陆FTP帐户后,使用命令 "quote SITE QUOTA" 后可显示当前用#户的磁盘限额
QuotaShowQuotas on
# SQL调用语句,不用修改
SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail,files_in_avail, files_out_avail, files_xfer_avail FROM quotalimits WHERE name = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM quotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{7}'" quotatallies
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" quotatallies
QuotaLimitTable sql:/get-quota-limit
进入mysql数据库命令状态:
# mysql –p
提示输入密码
建立数据库FTP(注意大小写和每句话后面的“;”)
CREATE DATABASE FTP;
然后在这个数据库中建立一个用户表FTPUSERS,这个表是必须的:
use FTP;
create table FTPUSERS (
userid TEXT NOT NULL,
passwd TEXT NOT NULL,
uid INT NOT NULL,
gid INT NOT NULL,
homedir TEXT,
shell TEXT
);
此表格是为了用户认证所需要的,其中userid、passwd是必不可少的,userid是用做FTP服务的用户名;passwd是指此用户的密码; uid是系统用户的ID,也就是所映射的系统用户;gid是所属系统组的ID;homedir是该用户所在的HOME目录;shell可以为该用户指定相 应的shell。当然你可以建立更多的字段,例如:用来记录用户登录次数的count,或者是日期的date,如果你对配置熟悉了之后,你可以根据自己的 喜欢添加更多的功能。在此就不多讲。
为了提供更多的功能,我们添加另外一个需要的表:FTPGRPS,也就是确定组的表格,这里是它的格式:
create table FTPGRPS (
groupname TEXT NOT NULL,
gid SMALLINT NOT NULL,
members TEXT NOT NULL
);
其中groupname是组的名称,gid是系统组的ID,members是组的成员。注意:多成员,他们之间要用逗号隔开,不能使用空格。
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者