Using /etc/aliases with groups

Brian McGrew Brian at doubledimension.com
Sat Sep 4 04:11:50 UTC 2004


Let's go old school Unix for a bit; because what you want to do isn't going to work with sendmail alone!  Add an entry in your aliases file:

\allusers: "|/etc/mail/mailallusers.sh"
(The \ prevents someone from further aliasing 'allusers')

Then create a script like the following (note this script may not be prefect, I'm on a Mac and writing it from memory, not a Unix box where I can test it).

#/etc/mail/mailallusers.sh
#!/bin/sh

me=`who am i | awk -F '{ print %1 }'`

for f in `cat /etc/group | grep '^users\:'`
do
    echo "Mailing $f" >> /tmp/mail_log.$$
    
    Mail $f < - >> /tmp/mail_log.$$
    Mail $me < /tmp/mail_log.$$
    
    rm /tmp/mail_log.$$
done
#end

Now the only caveat that I can think of is that I'm not sure if sendmail passes the message as stdin to the aliases program (the '-' on the first mail line signifies stdin); you may want to check that.  But back in the old school Unix days, we used to hand crank out mail processing scripts just like this.  

Hope this helps.


-brian

Brian D. McGrew {brian at doubledimension.com || pacemakertaker at rock.com }
---
> Failure is not an option; it is included with every Microsoft product.


-----Original Message-----
From: redhat-list-bounces at redhat.com
[mailto:redhat-list-bounces at redhat.com]On Behalf Of Eucke Warren
Sent: Friday, September 03, 2004 4:24 PM
To: Redhat Support Usergroup
Subject: Using /etc/aliases with groups


I have been googling and I have not hit upon a keyword combination that will shed light on this.  I would like to create a Group for mass emailing users on a server.  I have tried  adding a line like

everyone:        users

but the email ends up being rejected.  This is a sendmail setup and, yes, I did run newaliases after altering the /etc/aliases file.  Anyone doing this?  Suggestions on how to implement?  I intend to only make the group alias live when we want to do the mass Email and will disable it once it is sent to prevent unauthorized use.

Thanks guys!

-Eucke
-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request at redhat.com?subject=subscribe
https://www.redhat.com/mailman/listinfo/redhat-list





More information about the redhat-list mailing list