Re: [Proftpd-user] how is group quota working?
Kai Schaetzl <[email protected]>
| Newsgroups | gmane.network.proftpd.user |
|---|---|
| Message-ID | <[email protected]> |
TJ Saunders wrote on Tue, 29 May 2018 10:35:30 -0700:
Thanks for getting back to my question!
> Could you provide the mod_quotatab configuration that you are using?
This is the complete quota.conf. Proftpd on Ubuntu 16.04.
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on
QuotaOptions ScanOnLogin
QuotaExcludeFilter \.log$
QuotaDefault user false hard 104857600 0 0 0 0 0
# 104857600 = 100 MB
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 ftp_quota_limits 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 ftp_quota_tallies 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}'" ftp_quota_tallies
SQLNamedQuery insert-quota-tally FREEFORM "INSERT INTO ftp_quota_tallies SET name = '%u', quota_type = %{1}, ServerID = '%g'"
#SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" ftp_quota_tallies
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally
QuotaLock /run/proftpd/tally.lock
Quotalog /var/log/proftpd/quota.log
> The mod_quotatab module first looks for an applicable user limit. And then, if it doesn't find one, it looks for an applicable group
> limit.
That is what seems not to be happening here. If there is a user quota Proftpd uses it. If I change that to a group quota it pretends
there is no quota and uses the default.
> And if none found, it looks for an applicable class limit.
It also doesn't look for class. I didn't check that explicitely. But I would expect the search for the group and class quota be shown
in the log and no queries for group or quota show up there.
> Finally, there's the "all" limit.
>
> http://www.proftpd.org/docs/contrib/mod_quotatab.html#Usage
Not seeing that mentioned on that page. Do you mean the QuotaDefault setting?
Or an (undocumented?) user "all" in ftp_quota_limits?
>
> It sounds like you have an (unexpected?) user limit being found?
No, if I change user to group it uses the Default. It doesn't *look* for the group quota.
It looks to me like it stops when it can't find a user quota. It doesn't try other quotas. How can I go troubleshooting from here?
Step by step:
User is identified by table ftp_users and allowed to login. Now Proftpd looks in ftp_quota_limits for the user, starting with a
quota_type of "user", right?
That fails. Expected. What does ProFTPd do now? How does the ftp_groups table come into play here?
My expectation:
If I have a user=testme it should lookup that "members" in ftp_groups and if it finds it get the name of the group from groupname
(also testme in this case) and then use this value again in the query against ftp_quota_limits: WHERE name = 'testme' AND quota_type =
'group'
(My table ftp_groups uses one record per user = multiple records per group are possible,
as explained in documentation. Don't see what the gid is good for in that table, btw.)
Does it work like this? If so, what's the exact query it uses? Maybe that would explain the problem. Should I see that query in the
log? (I don't.)
> Most of the LogFormat variables should be usable in SQL queries:
> http://www.proftpd.org/docs/modules/mod_log.html#LogFormat
Ah, great, yes, this is what I was looking for.
Thanks!
Kai
--
Get your web at Conactive Internet Services: http://www.conactive.com
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
ProFTPD Users List <[email protected]>
Unsubscribe problems?
http://www.proftpd.org/list-unsub.html