Script for mailing /etc/passwd information

Kurian Thayil kurianmthayil at gmail.com
Fri Jun 5 13:48:45 UTC 2009


Hi,

As said, the script fetches the username and the shell information from the
/etc/passwd file and writes in a file. This file could be sent as an
attachment or just content. To mail this file as an attachment, then you
have to comment *cat $filename | mail -s "SUBJECT"
**mail at mail.com*<mail at mail.com> and
uncomment *mutt -a $filename -s "SUBJECT" **mail at mail.com* <mail at mail.com>.
Now to send only the contents of the file, comment *mutt -a $filename -s
"SUBJECT" **mail at mail.com* <mail at mail.com> and uncomment *cat $filename |
mail -s "SUBJECT" **mail at mail.com* <mail at mail.com>. Since 'mutt' is a
command line mail client, it will ask you to create the a mail box for the
logged in user. This is just a one time creation, the script will not ask
you to create mail box when run the second time as the same user.

Regards,

Kurian Thayil.

On Thu, Jun 4, 2009 at 7:08 PM, a bv <vbavbalist at gmail.com> wrote:

> Thanks , will be a dummylike question but what part to comment or not
> to comment  for teh to options? which lines?
>
> 2009/6/4 Kurian Thayil <kurianmthayil at gmail.com>:
>  > Hi,
> >
> > As said. There is nothing to be changed in the script. Once you choose
> > 'yes', it will not ask you again when the script is run the next time as
> the
> > same user. But make sure you run this script as the same user. If not,
> the
> > question is asked again. If this script is intended to run as a scheduler
> > (Cron job) then you will have to run this script as the user who has
> > assigned this cron job.
> >
> > If this is causing issues, you can use mail application (the uncommented
> > part in the script).
> >
> > Regards,
> >
> > Kurian Thayil.
> >
> > On Thu, Jun 4, 2009 at 5:29 PM, a bv <vbavbalist at gmail.com> wrote:
> >
> >> So what to chaneg on the script?
> >>
> >> 2009/6/3 a bv <vbavbalist at gmail.com>:
> >>  > Hi,
> >> > For the Kurian's script when i run with ./scriptname.sh i get
> >> > /home/myusername/Mail does not exist. Create it? ([yes]/no):
> >> >
> >> > Regards
> >> >
> >> >
> >> > 2009/6/1, Tatu Salin <tatusalin at hotmail.com>:
> >> >>
> >> >>
> >> >> There is good guides on net. Please check this if you have some help
> >> from
> >> >> this?
> >> >>
> >> >> http://www.freeos.com/guides/lsst/
> >> >>
> >> >>
> >> >>
> >> >> __________________________
> >> >> Tatu Salin
> >> >>
> >> >>
> >> >>
> >>
> ************************************************************************************************************************************************************************
> >> >> “Paranoia will get you through times of no enemies better than
> enemies
> >> will
> >> >> get you through times of no paranoia”
> >> >>
> >> >>
> >> >> ~ Pete Granger
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>> Date: Mon, 1 Jun 2009 16:48:45 +0300
> >> >>> From: vbavbalist at gmail.com
> >> >>> To: redhat-list at redhat.com
> >> >>> Subject: Re: Script for mailing /etc/passwd information
> >> >>>
> >> >>> Hi,
> >> >>>
> >> >>> I know , i like learn scripting for a long time (i have resources
> >> >>> online CBT etc) but im in an instant need, my main area is security
> >> >>> and through my work load i can only look at scripting at the
> weekends.
> >> >>>  Im in to bash scripting first then i would go pyhton not perl.
> >> >>> Regards
> >> >>>
> >> >>>
> >> >>>
> >> >>> 2009/6/1, Hike <mh1272 at gmail.com>:
> >> >>> > This a good time to learn.
> >> >>> > (Apart from the security nightmare you may be creating.)
> >> >>> >
> >> >>> > awk, cut, are to use inside a scripy
> >> >>> > perl would be good, too
> >> >>> >
> >> >>> > On Jun 1, 2009, at 9:10 AM, a bv <vbavbalist at gmail.com> wrote:
> >> >>> >
> >> >>> >> Hi list,
> >> >>> >>
> >> >>> >> I need a script which will get the users and their shell from
> >> >>> >> /etc/passwd file and mail it to the company mail account which i
> use
> >> >>> >> on Lotus Notes. Im not yet a scripting guy so i wanted to ask to
> >> you.
> >> >>> >>
> >> >>> >> Regards
> >> >>> >>
> >> >>> >> --
> >> >>> >> redhat-list mailing list
> >> >>> >> unsubscribe mailto:redhat-list-request at redhat.com
> >> ?subject=unsubscribe
> >> >>> >> 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
> >> >>> >
> >> >>>
> >> >>> --
> >> >>> redhat-list mailing list
> >> >>> unsubscribe mailto:redhat-list-request at redhat.com
> ?subject=unsubscribe
> >> >>> https://www.redhat.com/mailman/listinfo/redhat-list
> >> >>
> >> >> _________________________________________________________________
> >> >> Windows puhelimella saat enemmän vastinetta rahoillesi.
> >> >> http://www.windowsmobile.fi--
> >> >> redhat-list mailing list
> >> >> unsubscribe mailto:redhat-list-request at redhat.com?subjectunsubscribe
> >> >> 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
> >>
> > --
> > redhat-list mailing list
> > unsubscribe mailto:redhat-list-request at redhat.com?subjectunsubscribe
> > 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
>



More information about the redhat-list mailing list