Counting mail accounts on a system

Kevin Cozens kcozens-qazKcTl6WRFWk0Htik3J/w at public.gmane.org
Fri Jan 5 22:16:59 UTC 2007


Kihara Muriithi wrote:
>  Lets say I need to need to know how many mail accounts exist on  
> system, how would you do about it? I am thinking of counting directories 
> under /var/spool/mail, but I am not sure if the directory exist after 
> popping all mails. Counting accounts on the system would also not be 
> accurate, since that would include ftp, http users, who just exist 
> virtually.

Counting entries in /var/spool/mail will indicate the number of users who have 
received mail at one time or another. Even if a user has received mail and 
retreived the mail via POP there should still be a zero length file remaining 
in /var/spool/mail. If a person has never received mail you won't find a file 
in /var/spool/mail.

I would expect that any user listed in /etc/passwd that has a password set 
would have access to e-mail. This would depend on the type of e-mail server 
you are using. The only other think to look at is if you have set up some 
restrictions on who has e-mail. You can use that information to reduce the 
number of accounts you determine by other means.

-- 
Cheers!

Kevin.

http://www.interlog.com/~kcozens/ |"What are we going to do today, Borg?"
Owner of Elecraft K2 #2172        |"Same thing we always do, Pinkutus:
                                   |  Try to assimilate the world!"
#include <disclaimer/favourite>   |              -Pinkutus & the Borg
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list