Counting mail accounts on a system

Scott Elcomb psema4-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Thu Jan 4 07:55:37 UTC 2007


On 1/4/07, Kihara Muriithi <william.muriithi-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:
> Hi,
>  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. Any suggestion
> may be appreciated.

Not authoritative by any means (I'm not overly familiar with POP3),
but if all of your mail users are IMAP users [have user accounts on a
dedicated mail server (eg, UW-IMAP {using RHL xinetd defaults} and/or
SHELL=/dev/false)] then any User ID within the range UID 500 to 500+n
(where n=your number of users) should represent your User-Set.

Under at least RHL (Red Hat Linux/Fedora Core/CentOS) based systems,
this should work out as a nearly one-to-one correspondance with the
entries in /var/spool/mail/ by username.

With this type of setup, I usually count from 500 to 500+n and
determine specific user names from either /etc/passwd or MySQL
databases (on web servers via apache's modauth::mysql module).

YMMV using this approach of course.  Using SSL in this type of web
environment is highly recommended.  ;-)

-- 
Scott Elcomb
http://atomos.sourceforge.net/
http://search.cpan.org/~selcomb/SAL-3.03/
http://psema4.googlepages.com/

"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."

  - Benjamin Franklin

'"A lie can travel halfway around the world while the truth is putting
on its shoes."

  - Mark Twain
--
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