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:
- Activate quotas on the given filesystem.
- Create the
aquota.userfile at the FS' root, and remount.
edquotato 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.