I am currently setting up a machine which involves a lot of user accounts coming from a dynamic backend (MySQL database). I have successfully setup the system so that it uses that backend for all account-related operations (authentication, session, password management, ...) but now I would like to set quotas for all these users.

Now, when it comes to quotas on Linux, I would normally use quota files:

  1. Activate quotas on the given filesystem.
  2. Create the aquota.user file at the FS' root, and remount.
  3. Use quotacheck, quotaon, quotaoff and edquota to configure everything.

Now, the problem here is that these quota files are static, while many of my UNIX users are stored dynamically in my database. This means that when a user is added through this backend, I need quotas (also stored in the database) to be enforced on him immediately. Since new users may be added at any given moment, I don't really feel like connecting to the server every single time to edit quota information for the new user myself...

Is there a way to store quota information in a dynamic backend, just like other kind of account-related information? Or is there a more "common/typical" way to achieve such results, which I haven't though of?

(A little background) These users stored in a MySQL database have their own home directory, and can access it through FTP. Whatever they store there becomes available through a web server (shared hosting), and while PHP scripts may be used, these run with their owner's identity (suPHP). The point is, PureFTPd's quota file (.ftpquota) also belongs to the connecting user: while it's still impossible to remove that file through FTP, it may however be done through a PHP script running with similar privileges. I'm therefore looking for a more "robust" way to enforce quotas, that is, not through the FTP server which may be tricked into granting more diskspace than was originally granted.

The machine here is a Linux Debian Wheezy running PureFTPd as the FTP server, and Apache as the web server. Accounts are stored in a MySQL database, and linked to the system through libnss-mysql (account information retrieval) and pam-mysql (account management). Everything within a user's home belongs to that user and may therefore be altered by that very user.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.