Q&A: Protecting passwords in scripts and cron jobs?

scripts
by Kmeron

Question by Parand: Protecting passwords in scripts and cron jobs?
What’s a good way to protect passwords that need to be used in scripts and cron jobs? For example, the script might need a password for access to the database and another for access to a remote machine. I don’t want to put the plain-text passwords into the script. How do I enable the script to have access to the password but prevent anyone else from accessing it?

Best answer:

Answer by msafiullah
i encrypt the passwords. i like MD5 encryption. to verify if the user should be granted access to a restricted area, get user to enter password, encrypt this user input, and check if this matches the original encrypted password.

Know better? Leave your own answer in the comments!

Get the book now