全力打造多功能FreeBSD服务器( 五 )


# that this directive is necessary in this case because we specified
# the homedir field as "NULL", above. mod_sql needs to get homedir
# information from *somewhere*, otherwise it will not allow access.

# SQLDefaultHomedir "/tmp"

# This is not a mod_sql specific directive, but it"s here because of
# the way we specified "SQLUserInfo", above. By setting this to
# "off", we"re telling ProFTPD to allow users to connect even if we
# have no (or bad) shell information for them. Since we specified the
# shell field as "NULL", above, we need to tell ProFTPD to allow the
# users in even though their shell doesn"t exist.

RequireValidShell off

# Here we tell mod_sql how to get out group information. By leaving
# this commented out, we"re telling mod_sql to go ahead and use the
# defaults for the tablename and all the field names.
# SQLGroupInfo groups groupname gid members

# For small sites, the following directive will speed up queries at
# the cost of some memory. Larger sites should read the complete
# description of the "SQLAuthenticate" directive; there are options
# here that control the use of potentially expensive database
# queries. NOTE: these arguments to "SQLAuthoritative" limit the way
# you can structure your group table. Check the README for more
# information.

SQLAuthenticate users

# Finally, some example logging directives. If you have an integer
# field named "count" in your users table, these directives will
# automatically update the field each time a user logs in and display
# their current login count to them.
# SQLNamedQuery getcount SELECT "count, userid from users where userid="\u""
# SQLNamedQuery updatecount UPDATE "count=count 1 WHERE userid="\u"" users
# SQLShowInfo PASS "230" "You"ve logged on %{getcount} times, \u"
# SQLLog PASS updatecount

SQLHomedirOnDemand 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
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally


# close our block.



# To prevent DoS attacks, 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 normal user and group permissions for the server.
User ftpusr
Group ftpgrp

# Normally, we want files to be overwriteable.

AllowOverwrite on
AllowRetrieveRestart on
AllowStoreRestart on


# A basic anonymous configuration, no upload directories. If you
# don"t want to support anonymous access, simply remove this
#... block.


User ftp
Group ftp
# We want clients to be able to login with "anonymous" as well as "ftp"
UserAlias anonymous ftp

# Limit the maximum number of anonymous logins

推荐阅读