Limit size of /var/spool/mail/user

I'm new to linux and working for an ISP. I want to restrict the mail storage space for the users to 2MB in /var/spool/mail/user. The user has to keep his account below this limit, or else ISP sh'd be able to automatically remove some messages.

Appreciate your early reply for the same.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Well, given the lack of points offered, I assume
you only want a general answer to this question.
Download & install the quota package & rebuild
your kernel saying Y to "CONFIG_QUOTA".
If all your users are in the group 'mail' (for instance)
then all you need is a / file specifying
your 2mb limit (and the various other optional features - see the quota man pages).  If you want
to be able to set individual quotas (ie. some users
don't like the 2mb quota) then you'll need to set up
a /quota.user & set individual limits (ugh.)
you have to make quotas .. for users!!..

the process is easy yout adjust the points for question!!
tammarAuthor Commented:
Hi Xterm,

I appreciate your advice. But I want to set quota for the incoming e-mails for a user.

Eg. In the case of "hotmail" the incoming mail space is limited to 2MB and suppose you exceeded that limit, a message is posted by hotmail staff saying that the account has crossed the quota.

I want confgure my linix server in the same fashion.


The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Uh, I just told you how to do that.  Mail will bounce with "user exceeded quota" or something similar if the person's mailbox is 'full'.
You will have to enable quota on the filesystem which contains the mailboxes. Usually, the mail spool area will be on a separate filesystem, so enabling quota restrictions are easy. There a few steps you will have to take to enable quota.

Firstly, edit /etc/fstab to indicate quota for the particular filesystem. lookup man fstab - self-explanatory.
Secondly, you will have to create a per user quota , use edquota (again the man page is very simple).
Now you could run quotacheck and quotaon.
You are now in business ;).

This is ofcourse assuming that the mail spool area is on a separate fs. If not, there is no straightforward way to acheive the same.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tammarAuthor Commented:
Mail is bouncing with the user exceededing the quota. I don't want this to happen. The user should be given a warning message (Your mail box is full) and the messages should go through. Even then if the user doesn't clear his mail box then, the messages should be deleted.

So how did gautamm's answer help you circumvent this?  How lame to offer hardly any points for a detailed question & then accept an answer identical to that of the one you rejected.  Think about it.
tammarAuthor Commented:
I'm new to LinuxCare and this is my first query posted.

Since the rejectetion of your answer, didn't help me get a proper reply to  my comment, I was under the impression that the commnet of the answer which you accept is answered the better way.

So don't feel that I had been hard in not offering you any points.

Come on.. This is only the begining.
tammarAuthor Commented:
Now i have set the quotas and it works. But mail is bouncing with the user exceededing the quota.

Instead of that i want to flash a message to all the users who are nearing their quota limit, notifying them that their mail box is going to be full and they have to clear it.

Suppose I give a limit of 2MB to the user at 1.5MB of the /var/spool/mail/user size i want to give the message.

The message will be stored in a file and this should be directed to all the users who have crossed the 1.5MB size.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.