LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-19-2015, 09:00 AM   #1
forpostadds
LQ Newbie
 
Registered: May 2015
Posts: 2

Rep: Reputation: Disabled
Suppressing password in cron log file while sending mails


Hi Team,

I have setup few jobs with separate log files and separate EMail ID's for each job in my cron.
If something fails in these jobs, cron is delivering a mail to the mail ID that I have configured in cron as MAILTO= ( can be seen in crontab -l).

In this course, few passwords are also being returned as output from failed jobs which are being emailed to MAILTO ID.

I want to suppress the password while sending the cron output to the MAIL ID's.
Can anyone please guide me in this?

Note: I am not root user so I don't have access to /etc/syslog.conf.
 
Old 05-20-2015, 08:19 PM   #2
JeremyBoden
Senior Member
 
Registered: Nov 2011
Distribution: Debian
Posts: 1,195

Rep: Reputation: 243Reputation: 243Reputation: 243
Do these cron jobs have hard-coded passwords in them?
 
Old 05-30-2015, 01:28 PM   #3
forpostadds
LQ Newbie
 
Registered: May 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
Hi Jeremy,

Thanks for checking this.

Consider my crontab is as below:
crontab -l:

MAILTO=abx@gmail.com

***** /path/job1.sh > /log_PATH/job1.log
***** /path/job2.sh > /log_PATH/job2.log
***** /path/job3.sh > /log_PATH/job3.log

Now, if job1.sh (quits)returns from its script, it will return something like..
--username abc --password xyz...

Now in mail sent to abx@gmail.com we can see as :
--username abc --password xyz...


Hence, I want to suppress the password while sending the content.
Let me know if you need any further information.
 
Old 05-30-2015, 09:40 PM   #4
rigor
Member
 
Registered: Sep 2011
Posts: 254

Rep: Reputation: Disabled
Hi forpostadds.

Cron will tend to output whatever output is produced when a job is run by cron. Although that might be E-Mailed, logged, or processed otherwise depending upon how cron is configured, if your job produces a password as output, then the password will tend to be included in the output from cron.

So the issue is usually more about special treatment of passwords by the job itself rather some special treatment of passwords by cron.

If job1.sh (quits)returns from its script when it is not being run by cron and produces output that includes a password, then that password will be included in the output from cron.

So naturally you need to modify your shell scripts so that they don't output passwords.

If you are having trouble doing that, then we might be able to help you, if you are using standard Linux commands and if you actually tell us which specific commands you are running.

-----

Until recently I never suspected that the Internet can be accessed from Barsoom.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Cron Job not sending E-mails FortressMvelez Linux - Newbie 5 06-02-2013 10:26 PM
"sending mails through cron jobs: deepthi.deepu Linux - Server 1 06-14-2011 06:05 AM
Debian/Lenny - user cron jobs sending status e-mails garydale Linux - Server 4 09-04-2009 01:54 PM
Tar cmd as Cron Job / Suppressing logwatch's incremental info. Arakasi Linux - General 5 02-13-2007 03:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration