IMAP Files owned by ROOT

hostpc.com

Verified User
Joined
Aug 2, 2003
Messages
1,053
Location
Schenectady, NY
Recently we've seen several "runaway" processes by IMAP that show connections being opened for extended lengths of time.

I just looked at this users account. DA says she's using 97.1MB of her 200MB quota

Yet, her IMAP directories show::

-rw------- 1 root root 315467377 Sep 13 13:40 Deleted Messages
-rw-rw-rw- 1 root root 0 Sep 13 13:40 Deleted Messages.lock
-rw------- 1 root root 4973 Sep 13 12:53 Drafts
-rw------- 1 root root 550 Jun 26 21:26 INBOX.Drafts
-rw------- 1 root root 3003 Sep 9 11:15 INBOX.Sent
-rw------- 1 root root 4685171 Sep 9 11:25 INBOX.Trash
-rw------- 1 root root 565 Sep 3 08:39 Junk E-mail
-rw------- 1 root root 116411213 Sep 12 12:41 Sent
-rw------- 1 root root 147762 Sep 13 09:58 Sent Items
-rw------- 1 root root 606683910 Sep 13 13:17 Sent Messages
-rw------- 1 root root 578 Sep 3 08:51 Trash

Thats 997 MB of mail - which is killing the server - and totally ignoring the users quotas (since they're owned by root)

These files exist in the path:

/home/user/imap/domain.com/mailuser/mail


1. Why are these files owned by root, in the user directory

2. Why aren't these files calculated in total disk space used

3. How can IMAP be trimmed to NOT allow mailboxes of that size?


This is an urgent issue for us.

Exim 4.24
 
Last edited:
Have you emailed John?

The same problem exists on my server's, I dont know if there is a negative effect if a 'chown -R user:user *' is issued in /home/user/imap/domain.
 
Last edited:
I see this problem also, and I'm running the imapd installed when you run /usr/local/directadmin/scripts/imapd.sh

Nothing custom or out of the ordinary.

I tried a very quick and dirty fix just now on one server:
Code:
cd /home;for i in *; do chown -R $i:$i /home/$i/imap/; done

One user went from 90 something megs of disk usage to 1.1 GIGS of disk usage, putting him nearly 900 MEGS over his limit! This is most definitely a BAD THING.

Here's one example, on my own domain:

notice how the folders are owned by the user but when you get down to the actual mail folder it is root owned therefore not counting against the user:
Code:
[root@www html]# ll /home/dixieadmin/imap/
total 8
drwx------  4 dixieadmin dixieadmin 4096 Apr 14 23:35 dixiesys.com
[root@www html]# ll /home/dixieadmin/imap/dixiesys.com
total 16
drwx------  3 dixieadmin dixieadmin 4096 Apr 14 23:35 joe
drwx------  3 dixieadmin dixieadmin 4096 Apr 10 22:10 keith
[root@www html]# ll /home/dixieadmin/imap/dixiesys.com/keith
total 8
drwx------  2 root root 4096 Jul 21 23:10 mail
[root@www html]# ll /home/dixieadmin/imap/dixiesys.com/keith/mail
total 59972
-rw-------  1 root root 21390024 Apr 29 00:55 895Archive
-rw-------  1 root root 39872193 Apr 29 00:55 DixieArchive
-rw-------  1 root root      504 Apr 10 22:10 INBOX.Drafts
-rw-------  1 root root     1242 Jun 28 00:03 INBOX.Sent
-rw-------  1 root root      546 May  4 03:03 INBOX.Trash
-rw-------  1 root root    16092 Jul 21 22:10 Sent
-rw-------  1 root root      504 Apr 20 21:37 test
-rw-------  1 root root      546 May  1 12:33 Trash
 
The final lines of imapd.sh are:

fi

/bin/cp -f $FILE $DEST
/bin/chmod 755 $DEST
/bin/chown root:root $DEST

/bin/cp -f $INET /etc/xinetd.d/imap

we need a patched script - or a "go ahead" to run an ownership change manually as a stop gap solution.

Thanks guys.
 
If I recall correctly (and I sometimes do ;) ) the design decision was that mail would not be part of user quotas.

I've brought this thread to John's attention; let's see what he has to say.

Jeff
 
And at the time, I believe you said mail wouldn't be an issue for bandwidth or disk space...

Just shot that theory right down the tube.
 
hostpc.com said:
And at the time, I believe you said mail wouldn't be an issue for bandwidth or disk space...

Just shot that theory right down the tube.

I've seen way too many 2 gig inboxes on Ensim to ever say "mail wouldn't be an issue for disk space" email is always one of the WORST problems for disk space because people pack rat their email and won't delete it. I should know my personal mail server has over 7 gigs of my OWN email stored on it in imap folders :D

Had I realized before now IMAP mailboxes didn't count towards userspace I'da definitely asked about it.
 
Hello,

Thanks for pointing that out. I believe the problem relates to how I had done the counting of email data. If the email data in /var/spool was on a different partition than /home, then DA had to count email data manually because the system quotas wouldn't show it in "repquota /home". The problem was I added an "if" for the /home/username/imap for that case as well when it should have been counted manually all the time regardless.

The worst case for changing the data to "username" is that it might be counted twice, once by the system quotas, once by DA.

If changed the tally code to always count it manually, and to only count the files owned by root, so in the next release it should be fixed up.

If you play with this setting, you'll likely get it to count the imap usage:
http://www.directadmin.com/features.php?id=488
(but the imap usage isn't supposed to fall under that setting because it's not in /var/spool, hence the problem)

John
 
DirectAdmin Support said:
The worst case for changing the data to "username" is that it might be counted twice, once by the system quotas, once by DA.

Better to be counted twice than not at all :)
 
Dixiesys said:
Better to be counted twice than not at all
I'd say the opposite.

I'd say better to undercharge the client than to overcharge him/her.

:p

Jeff
 
A gig undercharge can be very costly for a hosting company especially over multiple user's not to mention the abuse that it allows. I would almost defenitly prefer double countage then none.
 
Back
Top