[sork] Accounts/quota
Eric Rostetter
eric.rostetter at physics.utexas.edu
Tue Jul 29 13:11:27 PDT 2003
Quoting MiikaT <mlist.horde2 at finansium.fi>:
> I made some test on RH 7.2 setup, and I found that quota worked pretty
> much the same way, as it does on the RH9 setup.
Well, okay. My explaination was a bit off... I guess you need to go
back further yet (like RH 6.x maybe) to get the other behaviour... Since
I use NFS, I always get that behaviour, no matter what OS version...
> I am not into hacking the c code of the quota source, so is there any
There is no need to for RH >= 8. Just hack the Horde/IMP/accounts code.
> tests/logs, which could tell us anything, what accounts is trying to do when
> accessing quota? Basically just to see, if sudo and other setup is ok.
Okay, here is how I would do this on RH 9, on a machine which does not allow
user logins (Horde/IMP server):
$ su
(enter root password)
$ chmod u+s /usr/bin/quota
$ chown root:root /usr/bin/quota
$ exit
Now, either get the code from:
https://mail.ph.utexas.edu/patches/wu-imap-quotas/readme.quotas-suid
or use the code included in IMP/accounts if you have recent versions:
imp/lib/Quota/command.php
accounts/lib/Driver/localhost.php
Now, in the code, find the line that reads:
$homedir = split( "/", $passwd_array['dir'] );
That line gets the first part of the home directory field
from the passwd file info. So if your password file contains:
username:x:999:999:Eric Rostetter:/home/eric:/bin/bash
Then it would return "/home" for the 'homedir' variable.
Now do a "quota -u username" and see what device or directory info is
returned. For example, on an NFS mounted machine it might say:
Disk quotas for user username (uid 9999):
Filesystem blocks quota limit grace files quota limit grace
server:/home 135720 200000 205000 3270 0 0
In this case, you are all set, as "/home" from the password file matches the
"/home" in the quota output, and everything will work great.
On a RH 9 non-NFS machine, it might say:
Disk quotas for user username (uid 9999):
Filesystem blocks quota limit grace files quota limit grace
/dev/Volume00/LogVol03 135720 200000 205000 3270 0 0
Now, you have a problem as "/home" won't match with "/dev/Volumn00/LogVol03"
and hence it won't report a quota.
So, what to do? Well, several possible things, depending on your setup.
1) If all your users are on the same disk, e.g. /dev/Volume00/LogVol03, then
change:
$homedir = split("/", $passwd_array['dir']);
to:
$homedir = "/dev/Volume00/LogVol03";
And you are done.
2) If your users are on different disks, but only have a quota on one, then
quota probably only returns one entry. Set the homedir to something that
will always match the quota line, like:
$homedir = "/dev";
And you are done.
3) If your users are on different disks, and have quotas on multiple disks
or your quota command returns more than one disk anyway, etc. then you have
a problem.... No idea how to solve this. You need to find some common
string that grep can key on to get the correct line each time. Good luck!
> -MiikaT
--
Eric Rostetter
The Department of Physics
The University of Texas at Austin
Why get even? Get odd!
More information about the sork
mailing list