免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2345 | 回复: 7
打印 上一主题 下一主题

[FTP] 我的proftpd 1.2.10可以正常登陆,限额也可以用,但是已用数量不能更新 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-12-02 00:04 |只看该作者 |倒序浏览
我是这的proftpd.conf文件

  1. bash-2.03# more /usr/local/proftpd/etc/proftpd.conf
  2. ServerName                      "Server"
  3. ServerType                      Standalone
  4. ServerAdmin                     123@15.com

  5. # Hide as much as possible to outside users
  6. ServerIdent                     on "Welcome to the www.spst.cn FTP server. Please login..."
  7. DeferWelcome                    on

  8. DefaultServer                   on

  9. # Allow FTP resuming.
  10. # Remember to set to off if you have an incoming ftp for upload.
  11. AllowStoreRestart               on

  12. # Port 21 is the standard FTP port.
  13. Port                            21

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

  17. # To prevent DoS attacks, set the maximum number of child processes
  18. # to 30.  If you need to allow more than 30 concurrent connections
  19. # at once, simply increase this value.  Note that this ONLY works
  20. # in standalone mode, in inetd mode you should use an inetd server
  21. # that allows you to limit maximum number of processes per service
  22. # (such as xinetd).
  23. MaxInstances                    30

  24. # Set the user and group under which the server will run.
  25. User                            nobody
  26. Group                           nogroup

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

  30. # Normally, we want files to be overwriteable.

  31.   AllowOverwrite                on



  32. # User quotas
  33. # ===========
  34. QuotaEngine on
  35. QuotaDirectoryTally on
  36. QuotaDisplayUnits Mb
  37. QuotaShowQuotas on
  38. QuotaLog "/usr/local/proftpd/var/log/quota.log"





  39. # The passwords in MySQL are encrypted using CRYPT
  40. SQLAuthTypes            Plaintext Crypt
  41. SQLAuthenticate         users* groups*

  42. # used to connect to the database
  43. # databasename@host database_user user_password
  44. SQLConnectInfo  proftpd@localhost proftpd 123456

  45. # Here we tell ProFTPd the names of the database columns in the "usertable"
  46. # we want it to interact with. Match the names with those in the db
  47. SQLUserInfo     ftpuser userid passwd uid gid homedir shell

  48. # Here we tell ProFTPd the names of the database columns in the "grouptable"
  49. # we want it to interact with. Again the names match with those in the db
  50. SQLGroupInfo    ftpgroup groupname gid members

  51. # set min UID and GID - otherwise these are 999 each
  52. SQLMinID        500

  53. # create a user's home directory on demand if it doesn't exist
  54. SQLHomedirOnDemand on

  55. # Update count every time user logs in
  56. SQLLog PASS updatecount
  57. SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" ftpuser

  58. # Update modified everytime user uploads or deletes a file
  59. SQLLog  STOR,DELE modified
  60. SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser

  61. # User quotas
  62. # ===========
  63. #QuotaEngine on
  64. #QuotaDirectoryTally on
  65. #QuotaDisplayUnits Mb
  66. #QuotaShowQuotas on
  67. #QuotaLog "/usr/local/proftpd/var/log/quota.log"

  68. SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_
  69. avail, files_in_avail, files_out_avail, files_xfer_avail FROM ftpquotalimits WHERE name = '%{0}' AND quota_type = '%{1}'"

  70. SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used, files_
  71. out_used, files_xfer_used FROM ftpquotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"

  72. SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_
  73. xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, files_xfer_
  74. used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{7}'" ftpquotatallies

  75. SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" ftpquotatallies

  76. QuotaLimitTable sql:/get-quota-limit
  77. QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally


  78. RootLogin off
  79. RequireValidShell off



复制代码





用户登陆正常,限额也可以用,超过限额就上传不上去了。

但是我用quote SITE QUOTA查看已用空间时,不管上传多少文件ftpquotatallies表中的记录都不更新。在新建用户的时候我在ftpuser和ftpquotalimits表中插入了数据,ftpquotatallies表也会生成相应的记录,只有user和quota_type有值,剩下的都是0,以后我上传数据后再用quote SITE QUOTA查看,还是老样子。看来是根本没有更新,请大家帮我看看。

另外为什么我的proftpd没有日志,在哪儿都找不到


  1. 230 User testaccount logged in.
  2. ftp> quote SITE QUOTA
  3. 200-The current quota for this session are [current/limit]:
  4. Name: testaccount
  5. Quota Type: User
  6. Per Session: True
  7. Limit Type: Hard
  8.    Uploaded Mb: 0.00/15.00
  9.    Downloaded Mb:       0.00/9.54
  10.    Transferred Mb:      0.00/0.01
  11.    Uploaded files:      0/100000
  12.    Downloaded files:    0/1000000
  13.    Transferred files:   0/10000000
复制代码



下面是我的数据库


  1. mysql> select * from ftpuser;
  2. +----+-------------+-----------+------+------+--------------------+---------------+-------+---------------------+---------------------+
  3. | id | userid      | passwd    | uid  | gid  | homedir            | shell         | count | accessed            | modified            |
  4. +----+-------------+-----------+------+------+--------------------+---------------+-------+---------------------+---------------------+
  5. |  1 | test        | passwd    | 5000 | 5000 | /home/ftp/chuan    | /sbin/nologin |    15 | 2005-12-01 16:12:01 | 2005-12-01 16:23:18 |
  6. |  2 | test2       | passwd    | 5000 | 5000 | /home/ftp/test2    | /sbin/nologin |    11 | 2005-12-01 23:10:14 | 2005-12-01 15:22:03 |
  7. |  3 | testaccount | ftppasswd | 5500 | 5500 | /home/ftp/test.com | /sbin/nologin |     7 | 2005-12-01 23:45:53 | 2005-12-01 23:43:10 |
  8. +----+-------------+-----------+------+------+--------------------+---------------+-------+---------------------+---------------------+
  9. 3 rows in set (0.00 sec)

复制代码



  1. mysql> select * from ftpgroup;
  2. +-----------+------+---------+
  3. | groupname | gid  | members |
  4. +-----------+------+---------+
  5. | ftpgroup  | 5000 | ftpuser |
  6. +-----------+------+---------+
  7. 1 row in set (0.00 sec)


复制代码






  1. mysql> select * from ftpquotalimits;
  2. +-------------+------------+-------------+------------+----------------+-----------------+------------------+----------------+-----------------+------------------+
  3. | 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 |
  4. +-------------+------------+-------------+------------+----------------+-----------------+------------------+----------------+-----------------+------------------+
  5. | test        | user       | true        | hard       |       15728640 |        15728640 |         30000000 |            200 |             200 |              400 |
  6. | test2       | user       | true        | hard       |       15728640 |        15728640 |         30000000 |            200 |             200 |              400 |
  7. | testaccount | user       | true        | hard       |       15728640 |        10000000 |            10000 |         100000 |         1000000 |         10000000 |
  8. +-------------+------------+-------------+------------+----------------+-----------------+------------------+----------------+-----------------+------------------+
  9. 3 rows in set (0.00 sec)



复制代码









  1. mysql> select * from ftpquotatallies;
  2. +-------------+------------+---------------+----------------+-----------------+---------------+----------------+-----------------+
  3. | name        | quota_type | bytes_in_used | bytes_out_used | bytes_xfer_used | files_in_used | files_out_used | files_xfer_used |
  4. +-------------+------------+---------------+----------------+-----------------+---------------+----------------+-----------------+
  5. | test        | user       |             0 |              0 |               0 |             0 |              0 |               0 |
  6. | test2       | user       |             0 |              0 |               0 |             0 |              0 |               0 |
  7. | testaccount | user       |             0 |              0 |               0 |             0 |              0 |               0 |
  8. +-------------+------------+---------------+----------------+-----------------+---------------+----------------+-----------------+
  9. 3 rows in set (0.01 sec)



复制代码

论坛徽章:
0
2 [报告]
发表于 2005-12-02 20:16 |只看该作者
顶一下,谁帮我看一下吧,几天了都没有搞定

论坛徽章:
0
3 [报告]
发表于 2005-12-02 20:48 |只看该作者
改成这样试试:

SQLNamedQuery update-quota-tally  FREEFORM \
"UPDATE ftpquotatallies  SET 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}'"

SQLNamedQuery insert-quota-tally FREEFORM \
    "INSERT INTO ftpquotatallies VALUES ('%{0}','%{1}','%{2}','%{3}','%{4}','%{5}','%{6}','%{7}')"

论坛徽章:
0
4 [报告]
发表于 2005-12-03 22:01 |只看该作者
呵呵,谢谢wolfg版主,一下搞定了,再次谢谢wolfg

论坛徽章:
0
5 [报告]
发表于 2006-06-08 17:34 |只看该作者
和你同样的问题,但是按照wolfg说的方法改了,却没有生效,不知道为什么,另外我安装的是proftpd 1.3.0


我的conf如下

  1. # This is a basic ProFTPD configuration file (rename it to
  2. # 'proftpd.conf' for actual use.  It establishes a single server
  3. # and a single anonymous login.  It assumes that you have a user/group
  4. # "nobody" and "ftp" for normal operation and anon.

  5. ServerName                        "ProFTPD Default Installation"
  6. ServerType                        standalone
  7. DefaultServer                        on

  8. # Port 21 is the standard FTP port.
  9. Port                                21

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

  13. # To prevent DoS attacks, set the maximum number of child processes
  14. # to 30.  If you need to allow more than 30 concurrent connections
  15. # at once, simply increase this value.  Note that this ONLY works
  16. # in standalone mode, in inetd mode you should use an inetd server
  17. # that allows you to limit maximum number of processes per service
  18. # (such as xinetd).
  19. MaxInstances                        30

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

  23. #User                           ftpuser
  24. #Group                          ftpgroup

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

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

  30. # Bar use of SITE CHMOD by default
  31. <Limit SITE_CHMOD>
  32.   DenyAll
  33. </Limit>



  34. QuotaEngine on
  35. QuotaDirectoryTally on
  36. QuotaDisplayUnits Mb
  37. QuotaShowQuotas on
  38. QuotaLog "/var/log/quota"

  39. SQLAuthTypes Backend Plaintext
  40. SQLAuthenticate users* groups*

  41. SQLConnectInfo ftpdb@localhost root 12345678
  42. SQLUserInfo ftpuser userid passwd uid gid homedir shell
  43. SQLGroupInfo ftpgroup groupname gid members
  44. SQLHomedirOnDemand on
  45. SQLLog PASS updatecount
  46. SQLNamedQuery updatecount UPDATE "count=count+1,accessed=now() WHERE userid='%u'" ftpuser
  47. SQLLog STOR,DELE modified
  48. SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser


  49. 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 ftpquotalimits WHERE name = '%{0}' AND quota_type = '%{1}'"
  50. 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 ftpquotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"

  51. SQLNamedQuery update-quota-tally  FREEFORM \
  52. "UPDATE ftpquotatallies  SET 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}'"

  53. SQLNamedQuery insert-quota-tally FREEFORM \
  54. "INSERT INTO ftpquotatallies VALUES ('%{0}','%{1}','%{2}','%{3}','%{4}','%{5}','%{6}','%{7}')"

  55. QuotaLimitTable sql:/get-quota-limit
  56. QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally

  57. RootLogin off
  58. RequireValidShell off
复制代码

[ 本帖最后由 syncml 于 2006-6-8 18:21 编辑 ]

论坛徽章:
0
6 [报告]
发表于 2006-06-08 23:00 |只看该作者
SQLNamedQuery update-quota-tally  FREEFORM \
"UPDATE ftpquotatallies  SET 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}'"

SQLNamedQuery insert-quota-tally FREEFORM \
"INSERT INTO ftpquotatallies VALUES ('%{0}','%{1}','%{2}','%{3}','%{4}','%{5}','%{6}','%{7}')"
去掉\,把每个语句都变成一行

论坛徽章:
0
7 [报告]
发表于 2006-06-09 12:40 |只看该作者
你把ftpquotalimits表中per_session中的值改成false试试看

论坛徽章:
0
8 [报告]
发表于 2006-06-09 13:22 |只看该作者
原帖由 ptsmy 于 2006-6-9 12:40 发表
你把ftpquotalimits,表中per_session中的值改成false试试看


谢谢ptsmy,谢谢版主,搞定了,不过我把

  1. #SQLNamedQuery update-quota-tally FREEFORM "UPDATE ftpquotatallies  SET 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}'"
  2. #SQLNamedQuery insert-quota-tally FREEFORM "INSERT INTO ftpquotatallies VALUES ('%{0}','%{1}','%{2}','%{3}','%{4}','%{5}','%{6}','%{7}')"
复制代码


还是改成了原来的
  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}'" ftpquotatallies
  2. SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" ftpquotatallies
复制代码


因为前者,我上传文件的时候,表里面记录的是负值,改成了原来的就正确了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP