WordPress can write/delete files under suexec but can not edit them?
-
Hi. I have a WordPress site set up with suexec on a L.A.M.P. host and would like to allow users to admin their themes, plugins and files via the GUI.
Currently all of the files in the WordPress directory are owned by the FTP user on the server. Generally folders are set to 755 and files to 644.
WordPress IS able to CREATE and DELETE files and directories after adding this to the wp-admin per https://codex.www.ads-software.com/Editing_wp-config.php:
/** Server does not allow insecure FTP connections */
/** Force WordPress to use SSH connection */
/** This eliminates the need to log in every time */
define(‘FS_METHOD’, ‘ssh2’);
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’, ‘ftpusername’);
define(‘FTP_PASS’, ‘ftppassword’);
define(‘FTP_HOST’, ‘sitename.com’);At this point WordPress is NOT able to EDIT the files, for example, within a theme. Pulling up a file like style.css the GUI editor displays this message:
“You need to make this file writable before you can save your changes. See the Codex for more information.”
Manually changing the file in question to 666 “fixes” the problem, but is not a good solution as it requires CLI or SFTP changes every time a new theme is installed.
I have not found a way to make WordPress write the files using the permissions it needs. The codex suggested that adding this to wp-config.php would work:
define(‘FS_CHMOD_DIR’, (0755 & ~ umask()));
define(‘FS_CHMOD_FILE’, (0644 & ~ umask()));But it did not.
Directories did not seem to be the problem so I changed the second line to this:
define(‘FS_CHMOD_FILE’, (0666 & ~ umask()));
The questions!
(1) is define(‘FS_CHMOD_FILE’ the “correct” solution to the problem I’m having with files not being editable from the WordPress admin?
(2a) If so: does anyone know what I’m doing wrong that is preventing WordPress from knowing it can change the perms and overwrite the file
(2b) If not: does anyone know the right solution?
- The topic ‘WordPress can write/delete files under suexec but can not edit them?’ is closed to new replies.