HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   Incorrect FTP quota (http://www.howtoforge.com/forums/showthread.php?t=54143)

ircf 15th September 2011 17:12

Incorrect FTP quota
 
Hello,

I have installed ISP Config 3.0.3 on Squeeze Debian and PureFtp shows incorrect quota usage on logging :
Code:

Commande :        USER test
Réponse :        331 User test OK. Password required
Commande :        PASS ********
Réponse :        230-User test has group access to:  client1    sshusers 
Réponse :        230-OK. Current restricted directory is /
Réponse :        230 515869 Kbytes used (50%) - authorized: 1024000 Kb

--

du -sh /var/www/clients/client1/web1/
63M        /var/www/clients/client1/web1/

--

ls -la /var/www/test.com/

drwxr-x--x  6 web1 client1  200 26 févr.  2011 .
drwxr-xr-x 176 root root    10536 15 sept. 09:40 ..
drwxr-x--x  2 web1 client1    48 12 févr.  2011 cgi-bin
-rwxr-xr-x  1 root root      40 26 févr.  2011 .htpasswd_stats
lrwxrwxrwx  1 web1 client1    38 12 févr.  2011 log -> /var/log/ispconfig/httpd/test.com
drwxr-x--x  2 web1 client1    48 12 févr.  2011 ssl
drwxrwxrwx  2 web1 client1    48 12 févr.  2011 tmp
drwx--x---  4 web1 client1  128 12 févr.  2011 web


User name and website host have been change for obvious reasons...

Any idea where I should start debugging this please ?

till 15th September 2011 18:43

Why are you so sure that the quota usage is incorrect? The Quota for a FTP User is the quota of the web[ID] linux user, if the quota is not set separately for this FTP user in the ftp user settings. So if you want to check if the quota is correct, run the command:

repquota -avu | grep web1

And you should update your ispconfig version, 3.0.3 is quite old, the current version is 3.0.3.3

ircf 15th September 2011 19:07

Weirder...
 
Mmm... This is getting weirder and weirder...

I checked the quota and here is what I got :

Code:

repquota -avu | grep web1

Période de sursis bloc : 7days ; période de sursis inode : 7days
                        Block limits                File limits
Utilisateur    utilisé souple stricte sursis utilisé souple stricte sursis
----------------------------------------------------------------------
web1    --      0  512000  513024              0    0    0

I pasted the table header to make it more comprehensive...

Indeed, this morning, the quota was 500MB, I passed it to 1GB when I noticed it was "full". I ran several time :

Code:

quotaoff -avug
quotacheck -avugm
quotaon -avug

But this make no difference... Here are my questions :

1- Is it normal that quota here is 500MB while PureFtp shows 1GB ?
2- Is it normal that usage here is 0 while PureFtp shows 512MB ?
3- If usage really is 512MB, where could I find (and destroy) the (useless) files ? Because my website is only 63MB... I mean the user home dir is 63MB, how could it have written so much files outside of his home ? (this is a tiny website, not very popular...)

Thank you for your precious time Till, you do a really great job ! ;)

PS : I'll upgrade ASAP, unfortunately this is not so easy because I had to make some hacks... I don't think this problem is really related with ISP Config anyway, or is it ?

ircf 21st September 2011 19:17

Solution and last question...
 
Hi again :)

I got a solution to this problem, the .ftpquota file in /var/www/test.com was not up-to-date. I ran this command to fix it :

Code:

pure-quotacheck -u web1 -d /var/www/test.com
I have looked in ISP Config cron daily but I didn't see it...

I suppose I have to add a line in my crontab to update ftpquota files on a regular basis, is that alright ?

Thank you for your support.

till 21st September 2011 22:50

ISPConfig does not use nor create a file called .ftpquota in the website. So this file must have been added by a different software and thats also the reason why its not updated by ispconfig.

ircf 25th October 2011 11:28

Integrate pure-quotackeck in ISPConfig ?
 
Hello again,

I couldn't find a solution to automate pure-quotacheck on each user dir so I added this script to my ISP Config cron_daily.php (right before the die("finished"); line) :

Code:

#######################################################################################################
// Check quotas for Pure FTP
#######################################################################################################

$sql = "SELECT document_root, system_user FROM web_domain WHERE server_id = ".$conf['server_id'];
$records = $app->db->queryAllRecords($sql);
$app->uses('system');
if(is_array($records)) {
        foreach($records as $rec){
                $web_path = realpath(escapeshellcmd($rec['document_root']));
                $web_user = $rec['system_user'];
                if($web_path != '' && strlen($web_path) > 10 && is_dir($web_path) && $app->system->is_user($web_user)){
                        //echo "/usr/sbin/pure-quotacheck -u $web_user -d $web_path\n";
                        exec("/usr/sbin/pure-quotacheck -u $web_user -d $web_path");
                }
        }
}

I just copied/pasted the "clear tmp dir" section and replaced some code.

That could be a good thing to add a test to ensure system uses pure-ftp and maybe add this script to the official cron_daily.php ? :D

Because without this, FTP quotas with pure-ftp just won't be updated (and won't work), or maybe there is another way to handle FTP quotas with pure FTP in ISP Config ? :confused:

Thank you.

till 25th October 2011 12:34

ISPConfig uses Linux system quotas for websites and not pure-ftpd quotas. Linux system quotas are handled by the filesystem automatically and are configured in /etc/fstab. They are used for ftp and ssh users, linux system quotas dont have to be updated manually with pure-quotacheck.

ISPConfig does not use a file called .ftpquota in its default install, so there is no need to update that from ispconfig side. If you use a different setup though, then you might have to use your own scripts.


All times are GMT +2. The time now is 10:50.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.