Problem with FTP Quotas

Discussion in 'HOWTO-Related Questions' started by FreeVPS, Oct 30, 2006.

  1. FreeVPS

    FreeVPS New Member

    When I have these in my pure-ftpd mysql config file:

    Code:
    # Optional : query to get the maximal number of files
    # Pure-FTPd must have been compiled with virtual quotas support.
    
    # MySQLGetQTAFS  SELECT QuotaFiles FROM users WHERE User="\L"
    
    MySQLGetQTAFS   SELECT QuotaFiles FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
    
    
    # Optional : query to get the maximal disk usage (virtual quotas)
    # The number should be in Megabytes.
    # Pure-FTPd must have been compiled with virtual quotas support.
    
    # MySQLGetQTASZ  SELECT QuotaSize FROM users WHERE User="\L"
    
    MySQLGetQTASZ   SELECT QuotaSize FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
    
    The service won't start however if I comment them out the service runs fine. I'm storing all my details in a table called ftpd all other areas work except this, i've been trying various different ways of amending the sql query but no joy - anyone?
     
  2. FreeVPS

    FreeVPS New Member

    I've tried running strace on this for about an hour and cannot see why it's failing.

    This is all is in my logs:

    Oct 30 13:25:57 mercury pure-ftpd: (?@?) [ERROR] Configuration error: Invalid SQL configuration file: /etc/pure-ftpd/mysql.conf
    Oct 30 13:26:49 mercury last message repeated 2 times
    Oct 30 13:28:02 mercury pure-ftpd: (?@?) [ERROR] Configuration error: Invalid SQL configuration file: /etc/pure-ftpd/mysql.conf
    Oct 30 13:31:49 mercury last message repeated 2 times

    I'm using Fedora Core 5

    As I say above if i remove those two lines it works ok - but if I enable them ftp falls over.
     
  3. falko

    falko Super Moderator Howtoforge Staff

    I think you must escape the quotation marks in the two lines:

    Code:
    MySQLGetQTAFS   SELECT QuotaFiles FROM ftpd WHERE User="\L" AND status=\"1\" AND (ipaccess = \"*\" OR ipaccess LIKE \"\\R\")
    
    MySQLGetQTASZ   SELECT QuotaSize FROM ftpd WHERE User="\L" AND status=\"1\" AND (ipaccess = \"*\" OR ipaccess LIKE \"\\R\")
     
  4. FreeVPS

    FreeVPS New Member

    Same problem :(

    Code:
    Nov  1 11:10:17 mercury pure-ftpd: (?@?) [ERROR] Configuration error: Invalid SQL configuration file: /etc/pure-ftpd/mysql.conf
    
     
  5. falko

    falko Super Moderator Howtoforge Staff

    What's in /etc/pure-ftpd/mysql.conf now?
     
  6. perldork

    perldork New Member

    Hi,

    You have to pass

    Code:
    --with-quotas
    to configure to enable the MySQLGetQTASZ and MySQLGetQTAFS configuration directives. Not well documented, I had to search through the source to find the

    Code:
    #ifdef QUOTAS
    section that showed the code and then the configure script itself to find which configure switch caused QUOTAS to be defined for compilation.
     

Share This Page