Securing MariaDB files on Linux
Filesystem security is an important part of keeping the data in our databases safe. This is because MariaDB, like most programs, stores the data it handles in files on our filesystem. If those files can be read and copied by anyone who can log in to the server, then there's nothing stopping them from making a copy of those files and then accessing them with MariaDB on another server. This recipe is about securing our files on Linux.
Getting ready
Prior to starting this recipe, use the package manager to install the tree
program.
On Fedora, Red Hat, or CentOS, run the following command:
sudo yum install tree
On Debian or Ubuntu, run the following command:
sudo apt-get install tree
How to do it...
Open a terminal window and run the following statements:
sudo tree -puga /usr/lib*/mysql /lib*/mysql \ /etc/mysql* /etc/my.cnf* /var/lib*/mysql
Stop MariaDB if it is running.
Change the ownership of all files that are not owned by either the
root
ormysql
users to whichever...