QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 836|回复: 0

proftp设置了磁盘限额的用户无法登陆,到底是什么问题啊?

[复制链接]
发表于 2005-6-12 21:32:56 | 显示全部楼层 |阅读模式
proftp设置磁盘限额后的用户无法登陆了,到底是什么问题啊??????

1、不设置磁盘限额的话所有用户登录一切正常。
2、只有设置磁盘限额的用户不能登陆而未设置的用户登陆一切正常,把磁盘限额去掉也能正常登录。

建立的mysql 数据表
CREATE TABLE quotalimits (
name VARCHAR(30),
quota_type ENUM("user", "group", "class", "all") NOT NULL,
per_session ENUM("false", "true") NOT NULL,
limit_type ENUM("soft", "hard") NOT NULL,
bytes_in_avail FLOAT NOT NULL,
bytes_out_avail FLOAT NOT NULL,
bytes_xfer_avail FLOAT NOT NULL,
files_in_avail INT UNSIGNED NOT NULL,
files_out_avail INT UNSIGNED NOT NULL,
files_xfer_avail INT UNSIGNED NOT NULL
);

CREATE TABLE quotatallies (
name VARCHAR(30) NOT NULL,
quota_type ENUM("user", "group", "class", "all") NOT NULL,
bytes_in_used FLOAT NOT NULL,
bytes_out_used FLOAT NOT NULL,
bytes_xfer_used FLOAT NOT NULL,
files_in_used INT UNSIGNED NOT NULL,
files_out_used INT UNSIGNED NOT NULL,
files_xfer_used INT UNSIGNED NOT NULL
);

quotatallies 记录了用户当前的磁盘使用情况,由程序自动记录。
quotalimits 设置磁盘限额,表中一些字段的含意如下:
quota_type 磁盘限额的鉴别
bytes_in_avail 上传最大字节数,就是FTP用户空间容量
bytes_out_avail 下载最大字节数
bytes_xfer_avail 总共可传输的文件的最大字节数(上传和下载流量)
files_in_avail 总共能上传文件的数目
files_out_avail 能从服务器上下载文件的总数目
files_xfer_avail 总共可传输文件的数目(上传和下载)


proftp配置文件如下:

# "nobody" and "ftp" for normal operation and anon.

ServerName "FTP TestServer"
ServerType standalone
DefaultServer on

# Port 21 is the standard FTP port.
Port 21

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022

TransferLog /var/log/ftp_transferlog
SystemLog /var/log/ftp_syslog

# 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
MaxClientsPerHost 20

# Set the user and group under which the server will run.
User nobody
Group nobody

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~

# Normally, we want files to be overwriteable.
AllowOverwrite on

UseReverseDNS off
IdentLookups off
ServerIdent off
DeferWelcome On

# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
DenyAll
</Limit>

# A basic anonymous configuration, no upload directories. If you do not
# want anonymous users, simply delete this entire <Anonymous> section.
<Anonymous ~>
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
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
<Limit WRITE>
DenyAll
</Limit>
</Anonymous>


SQLAuthTypes Backend Plaintext
SQLAuthenticate users* groups*

# databasename@host database_user pass
SQLConnectInfo ftpdb@localhost proftpd password
SQLUserInfo ftpuser userid passwd uid gid homedir shell
SQLGroupInfo ftpgroup groupname gid members
SQLHomedirOnDemand on
# Update count every time user logs in
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1,accessed=now() WHERE userid='%u'" ftpuser
# Update modified everytime user uploads or deletes a file
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser

QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits "Mb"
QuotaShowQuotas on
QuotaLog "/var/log/ftp_quota"

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


出错提示如下:
rhas (192.168.1.137[192.168.1.137]) - FTP session opened.
rhas (192.168.1.137[192.168.1.137]) - USER t1: Login successful.
rhas (192.168.1.137[192.168.1.137]) - FTP session closed.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-5 20:34 , Processed in 0.043094 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表