Using /etc/aliases with groups

Vipul Ramani linux2000in at gmail.com
Sat Sep 4 14:49:34 UTC 2004


hi ,
-----------------------------------------------------------------------------
#!/bin/sh
pgmname=$1
for user in $(cut -f1 -d: /etc/passwd); do
    mail $user <<- EOF
        Dear user,

        Linux is dammmmmmmm GOOD OS why dont go www.redhat.com n check it...
        Regards,
         linux2000in at gmail.com
       EOF
done
--------------------------------------------------------------------


On Fri, 3 Sep 2004 21:11:50 -0700, Brian McGrew
<brian at doubledimension.com> wrote:
> 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
> 
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
> 



-- 
Vipul Ramani
linux2000in at gmail.com
linux2000in at yahoo.com
~~~~~We Know HOW NetWorkS ~~~~~





More information about the redhat-list mailing list