FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 10-30-2008, 01:46 PM
Jussi Hirvi
 
Default List of all email users

This is not CentOS-specific, hence OT.

I need a list of all email users on my system (there are hundreds of them).
The list could be extracted from /etc/aliases and the virtusertable.

Does anyone know of a script that would do this automatically? It would have
to
- exclude commented-out lines (of course)
- exclude duplicates
- produce a list of usernames (or maybe unresolved email addresses for some
users) separated by a comma

I imagine perl would be the way to go. I haven't used perl at all myself.

Regards,
Jussi

--
Jussi Hirvi * Green Spot
Topeliuksenkatu 15 C * 00250 Helsinki * Finland
Tel. & fax +358 9 493 981 * Mobile +358 40 771 2098 (only sms)
jussi.hirvi@greenspot.fi * http://www.greenspot.fi

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-30-2008, 02:12 PM
Ralph Angenendt
 
Default List of all email users

Jussi Hirvi wrote:
> This is not CentOS-specific, hence OT.
>
> I need a list of all email users on my system (there are hundreds of them).
> The list could be extracted from /etc/aliases and the virtusertable.
>
> Does anyone know of a script that would do this automatically? It would have
> to
> - exclude commented-out lines (of course)
> - exclude duplicates
> - produce a list of usernames (or maybe unresolved email addresses for some
> users) separated by a comma


for i in /etc/aliases /etc/postfix/virtual; do
cat $i | grep -Ev "(^#|^s+$|^$)" | sed -e "s/://" | awk '{print $1}' |
sort -u | tr
,
done

Adapt to needs.

Ralph
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 10-30-2008, 02:22 PM
Jussi Hirvi
 
Default List of all email users

Ralph Angenendt (ra+centos@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
,
> done
>
> Adapt to needs.

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.

- Jussi

--
Jussi Hirvi * Green Spot
Topeliuksenkatu 15 C * 00250 Helsinki * Finland
Tel. & fax +358 9 493 981 * Mobile +358 40 771 2098 (only sms)
jussi.hirvi@greenspot.fi * http://www.greenspot.fi

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 07:42 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org