[CentOS] [OT] List of all email users

Thu Oct 30 16:26:07 UTC 2008
Ralph Angenendt <ra+centos at br-online.de>

Jussi Hirvi wrote:
> Ralph Angenendt (ra+centos at br-online.de) kirjoitteli (30.10.2008 17:12):
>> for i in /etc/aliases /etc/postfix/virtual; do
>> cat $i | grep -Ev "(^#|^\s+$|^$)" | sed -e "s/://" | awk '{print $1}' | \
>> sort -u | tr \\n ,
>> done
> 
> Thanks, that looks neat, and works.
> 
> For real-world use, I guess the source files (in my case aliases,
> virtusertable) should be prepared first - the list will include unwanted
> users like "bin" or "mysql", mailing list name defined in virtusertable, and
> possibly other strange things too.

And (I forgot to say that) - it weeds out users with a ":" in their mail
address, which is completely valid. So you should check that also.

Cheers,

Ralph
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.centos.org/pipermail/centos/attachments/20081030/cfb4b16a/attachment-0005.sig>