Tuesday, February 7, 2017

Fixing WordPress’ Plugin FTL download permissions WordPress 3 3 1 on CentOS Linux

Fixing WordPress’ Plugin FTL download permissions WordPress 3 3 1 on CentOS Linux


Hav­ing trou­ble with Word­Press’ auto update fea­ture? Con­fronting errors like "could not copy file…"  or is Word­Press ask­ing for FTP information?


Your prob­lem is most likely server per­mis­sions. If you have shell access to your own VPS/dedicated server, use the lines below. If you’re using a shared host­ing setup, try option #4 below, or con­tact your admin­is­tra­tor for help.

Option #1: chmod 777

Sure, you could CHMOD 777 your whole site. That would tech­ni­cally work, but it’s switch­ing per­mis­sions when­ever you need to update is incon­ve­nient. And, leav­ing per­mis­sions this way leaves you open to a whole host of secu­rity issues.
chmod -R 777  (Not Secure!)

Option #2: apache file permission

This gives apache full per­mis­sions. This works, but if you use FTP, users no longer have per­mis­sions to write files. No good! I want my FTP access intact.
chown -R apache:apache  (No FTP!)

Option #3: apache /w group permissions

I cre­ated a “word­press” group and added my FTP users to it and gave the wp-content direc­tory group write per­mis­sions. It’s a bit of a com­pro­mise, but it worked for me.
groupadd wordpress
useradd -G wordpress 
chmod -R 775 /wp-content/
chown -R apache:wordpress

Option #4: wp-config constants

Another option for those who are unable to change file per­mis­sions, and/or have a rel­a­tively new ver­sion of Word­Press, is to bypass enter­ing FTP infor­ma­tion by defin­ing your FTP info in your wp-config.php file. More infor­ma­tion can be found in the Word­Press codex.
define(FS_METHOD, ftpext);
define(FTP_BASE, /path/to/wordpress/);
define(FTP_CONTENT_DIR, /path/to/wordpress/wp-content/);
define(FTP_PLUGIN_DIR , /path/to/wordpress/wp-content/plugins/);
define(FTP_USER, username); 
define(FTP_PASS, password);
define(FTP_HOST, ftp.example.org);


Available link for download