CHMOD and CHOWN for WordPress are important to set properly during the setup. Improper setup usually throws errors for some Plugins and asks to chmod to 777. Details of chmod for an average user is written before, chown was shown in the guides to setup Server for WordPress. We will Explain both in this small explanatory guide.
CHMOD and CHOWN for WordPress : Understanding the Ownership
chown command changes the user and/or group ownership of for given file. The syntax is like other normal UNIX Command :
chown owner-user file
chown owner-user /directory/file
chown owner-user:owner-group file
chown owner-user:owner-group directory
chown options owner-user:owner-group file
Please understand the fact – if you are running one single server, improper chown to root user can prove to be helpful to the hackers, as the root user can change or setup user file related rights/permission. You must create an user and then chown the files of FTP – that is what we usually do.
CHMOD and CHOWN for WordPress : Why You Should Not CHMOD to 77 Recursively
No good UNIX user will ever direct you to chmod all FTP files to 777. But, these kind of ‘quick’ methods are quite common to see as directions in various supportive forums. If the chown part is done properly, the normally set chmod of WordPress (755) will nicely work. Never recursively chmod the whole wp-content, for example to 777.
Now, with properly chown-ed and chmod-ed files and directories, sometime some plugins might throw error and you might be thrown error – usually they are database cache plugins or related to cache. If your plugin’s name is wordpress-plugin and the cache folder is here :
You should never chmod even the whole wordpress-plugin directory recursively to 777. You will follow this way :
wp-content (chmod to 777 but not recursively)
wordpress-plugin (chmod to 777 but not recursively)
cache-files (chmod to 777 but not recursively)
cache ( # chmod to 777 recursively )
With this logic, the whole path :
is becoming writable to that plugin. Again, CHMOD and CHOWN for WordPress are important because the PHP files can directly execute commands on the database server. You must not do anything without understanding which can open the door to the hackers.
Follow the Author of this article :