title: CHMOD 777 on Directories for Database to be Able to Write (Help Me Understand)
body: <p>I have a limited understanding of MySQL's interaction with my CentOS 7 server and need some help. </p>
  
  <p>Basically, I have a WordPress installation and I need to set the uploads directory and all directories within to CHMOD 777 to upload images via the backend. CHMOD 775 doensn't work though. This baffled me and is something I am not willing to do as I unserstand the risks and how easily it can be exploited. I would be giving public write permissions in that folder and that is bad right?</p>
  
  <p>My database user has privileges to the database and the database connects. The website works minus writing part. Now what I don't understand is how the MySQL user relates to the local CentOS user at all. I don't believe that is linked anywhere and if I am wrong how would i do that? </p>
  
  <p>The reason I am thinking this is due to the CHMOD 775 not working meaning that the said database user is not a user or a member of the group required to have said access and to be able to write. Hence why I need local write permissions enabled.</p>
  
  <p>===================================================</p>
  
  <h1>MORE INFO</h1>
  
  <p>OS: CentOS 7
  , Server: Nginx
  , Database: MariaDB
  , PHP: PHP 5.4.3</p>
  
  <p>Local User Directory:
  /home - CHMOD 755, CHOWN root:root</p>
  
  <p>Local Users
  /home/usr1 - CHMOD 501, CHOWN usr1:usr1
  , /home/usr2 - CHMOD 501, CHOWN usr2:usr2</p>
  
  <p>Contains Website WWW:
  /home/usr1/www - CHMOD 775, CHOWN usr1:usr1
  , /home/usr2/www - CHMOD 775, CHOWN usr2:usr2</p>
  
  <p>Rest of Files/Directories:
  CHOWN usr1:usr1 for all files in WWW
  , CHOWN usr2:usr2 for all files in his respective WWW</p>
  
  <p>CHOWN 775 for all directories in WWW</p>
  
  <h1>CHOWN 644 for all files in WWW</h1>
  
  <p>So when I connect the database to the wordpress installation, how in the heck does it know to use root, usr1 or usr2. I tried putting them all in a group to see what happens but it didn't work. Thought it was worth a shot.</p>
  
  <p>Any help, advice, education and so and so forth is appreciated. Help me if you can please :)</p>
  
  <p>==================================================</p>
  
  <h1>I have access via SSH, I am on a VPS and as far as I know have complete access. So if you have a solution that requires me to do stuff, that is cool. I can do stuff!</h1>