The reason for yesterday’s Basic OS/MySQL Security was a request to review a system and I was given the production server ‘root’ password in an email. Never email a ‘root’ password, especially including the hostname as well. Email is an insecure protocol that can be monitored by hackers. However, today’s basic security tip following a look at the system is:
Never store the MySQL ‘root’ user password in a ~root/.my.cnf file.
There is simply no reason to do so, and you expose your database to destruction or manipulation when a user has access to the ‘root’ OS user, for example via sudo.
I’ve heard excuses why the ‘root’ MySQL password has to be in a file, I’ve yet to be convinced.
Do you need to store a MySQL password in a file? Yes. Connection management for your application is an …
[Read more]