Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001016 [SysCP] General feature always 2008-11-30 20:07 2009-04-02 12:42
Reporter monotek View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 1.4.1
Summary 0001016: Pureftpd - quota should be added
Description Pureftpd should have quotas enabled.

Edit "/etc/pure-ftpd/db/mysql.conf" and add to last line:

[code]
MySQLGetQTASZ SELECT panel_customers.diskspace/1024 AS QuotaSize FROM panel_customers, ftp_users WHERE username = "\L" AND panel_customers.loginname = SUBSTRING_INDEX('\L', 'ftp', 1)
[/code]


To update quota of existing users and count content which wasnt created from ftpd you can use the follwoing script. This should be done by syscp cronjob every night.

[code]
#!/bin/bash
#
# pureftpd quota - update quota of existing users
#

CUSTOMER_DIR="/var/customers/webs"
MYSQL_USER="syscp"
MYSQL_PASS=""
MYSQL_DB="syscp"

for CUSTOMER in `ls ${CUSTOMER_DIR}`; do
    BYTES="0"
    BYTES="`du -s ${CUSTOMER_DIR}/${CUSTOMER} | awk '{print $1 * 1024}'`"
    echo "update $CUSTOMER to $BYTES Bytes"
    echo "0 ${BYTES}" > ${CUSTOMER_DIR}/${CUSTOMER}/.ftpquota
    chown ${CUSTOMER}:${CUSTOMER} ${CUSTOMER_DIR}/${CUSTOMER}/.ftpquota

    for FTP_SUBUSER_DIR in `echo "SELECT homedir FROM ftp_users WHERE username LIKE '${CUSTOMER}ftp%'" | mysql -u${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB} | sed -e '1d'`; do
        echo "0 ${BYTES}" > ${FTP_SUBUSER_DIR}/.ftpquota
        chown ${CUSTOMER}:${CUSTOMER} ${FTP_SUBUSER_DIR}/.ftpquota
    done

done
[/code]
Additional Information
Tags No tags attached.
Attached Files ? file icon syscp142_pureftpd_quota.patch [^] (3,094 bytes) 2009-02-27 14:35
? file icon syscp142_ftpquota.patch [^] (30,828 bytes) 2009-03-03 17:28
? file icon syscp142_ftpquota_v2.patch [^] (34,676 bytes) 2009-03-04 16:48
? file icon syscp1421_ftpquota.patch [^] (38,481 bytes) 2009-04-02 12:42

- Relationships
related to 0001017feedback Proftpd - Quota should be added 

-  Notes
(0000329)
monotek (reporter)
2009-03-03 17:35
edited on: 2009-04-02 20:27

This is the final patch (syscp1421_ftpquota_.patch) for proftpd and pureftpd quota in syscp 1.4.2.1 (Please delete the other files).

admin_settings.php:
- new config option "FTP Server"


cron_traffic.php:
- updating also the column "bytes_in_used" of table "ftp_quotatallies" when "diskspace_used" of table "panel_customers" is updated.
- if purftpd is selected in admin_settings.php the .ftpquota files for purftpd quota is created in ftp user dirs


tables.inc.php:
- added tables "ftp_quotatallies" & "ftp_quotalimits"


admin_customers.php:
- if a new customer is created there is now also a new user in ftp_qoutatallies created
- if admin deletes customer all entries of customer in table ftp_quotatallies are deleted too.


update_1.4.inc.php:
- added ftpserver to table panel_settings
- new tables ftp_quotalimits and ftp_quotatallies
- content for ftp_quotalimits
- quota for all users in ftp_users is set in ftp_quotatallies


syscp.sql:
- added ftpserver to table panel_settings
- new tables ftp_quotalimits and ftp_quotatallies
- content for ftp_quotalimits


english.lng.php & german.lng.php::
- Updated with warning, that you also have to change the quota sql query in ftp server config, when changing ftp prefix.
- added ftpserver lng strings for admin_settings.php


settings_ftpserver.tpl
- template for admin_settings.php


- configs for all distros


No SVN - commits yet

- Issue History
Date Modified Username Field Change
2008-11-30 20:07 monotek New Issue
2008-11-30 22:59 EleRas Target Version => 1.4.x
2008-12-02 14:34 d00p Relationship added parent of 0001017
2008-12-02 14:36 d00p Status new => acknowledged
2008-12-02 14:36 d00p Projection none => minor fix
2008-12-02 14:36 d00p Category Adminpanel => General
2008-12-02 14:36 d00p ETA none => < 1 month
2008-12-02 14:36 d00p version 1.4 => 1.4.1
2008-12-02 14:37 d00p Relationship deleted parent of 0001017
2008-12-02 14:37 d00p Relationship added related to 0001017
2009-02-24 18:48 JamieWolf Status acknowledged => assigned
2009-02-24 18:48 JamieWolf Assigned To => d00p
2009-02-25 16:57 d00p Assigned To d00p =>
2009-02-25 20:37 JamieWolf Status assigned => new
2009-02-27 14:35 monotek File Added: syscp142_pureftpd_quota.patch
2009-02-27 14:37 monotek Note Added: 0000322
2009-02-27 15:43 monotek Note Edited: 0000322
2009-02-27 15:44 monotek Note Edited: 0000322
2009-02-27 15:45 monotek Note Edited: 0000322
2009-02-27 15:57 monotek Note Edited: 0000322
2009-02-27 17:52 monotek Note Edited: 0000322
2009-02-28 14:01 monotek Note Edited: 0000322
2009-03-03 17:28 monotek File Added: syscp142_ftpquota.patch
2009-03-03 17:35 monotek Note Deleted: 0000322
2009-03-03 17:35 monotek Note Added: 0000329
2009-03-04 16:48 monotek File Added: syscp142_ftpquota_v2.patch
2009-03-04 16:48 monotek Note Edited: 0000329
2009-04-02 12:42 monotek File Added: syscp1421_ftpquota.patch
2009-04-02 12:42 monotek Note Edited: 0000329
2009-04-02 12:42 monotek Note Edited: 0000329
2009-04-02 20:27 monotek Note Edited: 0000329
Footer