Re: Script for mailing /etc/passwd information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx*<mail@xxxxxxxx> and
uncomment *mutt -a $filename -s "SUBJECT" **mail@xxxxxxxx* <mail@xxxxxxxx>.
Now to send only the contents of the file, comment *mutt -a $filename -s
"SUBJECT" **mail@xxxxxxxx* <mail@xxxxxxxx> and uncomment *cat $filename |
mail -s "SUBJECT" **mail@xxxxxxxx* <mail@xxxxxxxx>. 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@xxxxxxxxx> 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@xxxxxxxxx>:
>  > 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@xxxxxxxxx> wrote:
> >
> >> So what to chaneg on the script?
> >>
> >> 2009/6/3 a bv <vbavbalist@xxxxxxxxx>:
> >>  > 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@xxxxxxxxxxx>:
> >> >>
> >> >>
> >> >> 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@xxxxxxxxx
> >> >>> To: redhat-list@xxxxxxxxxx
> >> >>> 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@xxxxxxxxx>:
> >> >>> > 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@xxxxxxxxx> 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@xxxxxxxxxx
> >> ?subject=unsubscribe
> >> >>> >> https://www.redhat.com/mailman/listinfo/redhat-list
> >> >>> >
> >> >>> > --
> >> >>> > redhat-list mailing list
> >> >>> > unsubscribe mailto:redhat-list-request@xxxxxxxxxx
> >> ?subject=unsubscribe
> >> >>> > https://www.redhat.com/mailman/listinfo/redhat-list
> >> >>> >
> >> >>>
> >> >>> --
> >> >>> redhat-list mailing list
> >> >>> unsubscribe mailto:redhat-list-request@xxxxxxxxxx
> ?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@xxxxxxxxxx?subjectunsubscribe
> >> >> https://www.redhat.com/mailman/listinfo/redhat-list
> >> >>
> >> >
> >>
> >> --
> >> redhat-list mailing list
> >> unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> >> https://www.redhat.com/mailman/listinfo/redhat-list
> >>
> > --
> > redhat-list mailing list
> > unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subjectunsubscribe
> > https://www.redhat.com/mailman/listinfo/redhat-list
> >
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>
-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subjecthttps://www.redhat.com/mailman/listinfo/redhat-list


[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux