From: garrett@garnet.berkeley.edu (Garrett D'Amore) Subject: About disk quotas... Date: 15 Apr 1993 01:32:04 GMT
I have a thought on quotas... my thinking originates from experience
as a Novell programmer. I'm no Un*x expert, and I'm new to Linux, but I
do write code and have I think enough understanding of how things work to
suggest a possible solution...
I think a quotad would work... hang-on, don't flame me just yet... :-)
1) Make a filesystem limit using *directories*. If quotas were based
on "max K per directory", this could very easily be translated to a
user basis, since most users (that you'd want to restrict) don't have
write privs. outside of /usr/spool, /tmp, and their home dir. You
wouldn't want to limit the spool and tmp dirs much, except maybe alert
root when a user's usage gets large without shrinking. Limit the home
directory.
2) Home dirs are limited by belonging to root or somesuch, with
g+rwx (where g is just root & the user). When the user's disk space
gets large enough, the daemon just turns off g+w in the home dir, and
a+w in all subdirs (recursively).
3) Quotad should e-mail both the user & root (or other admin) whenever
it takes action.
Problems to overcome:
1) quotad should know about mail spool dir, and use that when changing
permissions on home dir. Users could still cheat, but they would have
to use the spool dir. This is usually more inconvienent than tarring
and zipping or removing files in the users home dir (to the user).
2) quotad must know how to restore the rights to a users dirs at any
given time. In particular, it should restore the "w" rights only if
they were there before. This may be overcome in 1 of two ways (others?)
i) use some sort of database file to store original permissions.
ii) use extra permissions bits or inode bits if 3 bits can be found.
(try to avoid using inode bits to maintain fs portability)
3) user-owned sub-dirs... may be problematic. User could reset the
permissions if he owns them. Perhaps this can be solved by having
quotad automatically change subdir ownership at the same time that
it does chmod....
Advantages:
1) filesystem and kernel independent. (yay!)
2) spool files unaffected. (allows printing of big postscript files
and creation of temporary files) We use this type of restriction
instead of the user quotas in Netware 3.11 because users frequently
spool postscript files that are bigger than any quota we would give them,
but these spools are very temporary.
3) No problems if user does chown.
Disads:
1) can only be done to certain dirs? user doesn't get write access
elsewhere, or if he does it is unrestricted... ideas for fixes..
2) probably a kludge that is not terribly difficult to get around.
A kernel based solution would be more secure.
Any Linux hackers out there want to comment on this idea? Is it feasible?
Is it worth it? Is anyone working on a kernel or fs-based solution?
====================================================================
Garrett D'Amore | garrett@haas.berkeley.edu
Software Co-Ordinator | 68 Barrows Hall, UC Berkeley
Haas Computing Services | Ph: 510-643-5923 Fax: 642-4769
====================================================================