Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to write a cron job that authenticates for a certain mail account. As there are multiple ways in giving the script those credentails: config file, hardcoded in script, arguments in cronjob call,.. Where do I put those credentials?

(Currently I would favor as giving them the script via arguments as the script is then independent. But is that secure?)

Thanks for your thoughts.

share|improve this question
up vote 2 down vote accepted

Put the credentials into a file that has restricted read access.

Unless your cron tables already have similarly restricted read access. As grawity noted, putting the credentials into the crontab can result in them leaking to logs and/or email. Thus, it should be strongly discouraged and they should be properly protected inside a file.

share|improve this answer
Don't put them in the crontab itself; all cron jobs are logged in syslog and can sometimes be sent by email. – grawity May 3 '12 at 11:17
@grawity: Ahh, yes as you have written this I remember some weekly cronjob mails. – math May 3 '12 at 11:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .