Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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
4  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.