Cannot install plugins even though www-data has write permissions

All the files in my WordPress path are owned by myuser:www-data and Apache is running as www-data. All files and folders have group write permissions, e.g. -rw-rw----, but I keep being prompted for FTP details when I try to install a plugin.

If I chown the path to the www-data user, plugin installation and deletion work as expected, but then myuser cannot edit files. I could add myuser to the www-data group, but then myuser could access all other sites.

My files are chown’ed as follows:

chown -R myuser:www-data wordpress-folder/*

And chmod’ed as follows:

find wordpress-folder/ -type d -exec chmod 755 {} \;
find wordpress-folder/ -type f -exec chmod 644 {} \;

If my files are owned by the www-data group and are group-writable, then surely WordPress should be able to install plugins. Why can’t WordPress install plugins?

Here is the output of ls -la in my plugins folder:

total 48
drwxrwx---  9 myuser www-data 4096 Aug  5 01:26 .
drwxrwx---  6 myuser www-data 4096 Aug  5 01:51 ..
drwxrwx---  6 myuser www-data 4096 Jul 10 16:27 disqus-comment-system
-rw-rw----  1 myuser www-data 6148 Jul 10 15:37 .DS_Store
drwxrwx---  7 myuser www-data 4096 Jul 10 16:30 gravityforms
-rw-rw----  1 myuser www-data   30 Jul 10 15:37 index.php
drwxrwx---  3 myuser www-data 4096 Jul 10 16:30 lime-export
drwxrwx---  6 myuser www-data 4096 Aug  1 11:17 mp6
drwxrwx---  6 myuser www-data 4096 Aug  5 01:26 rewrite
drwxrwx--- 10 myuser www-data 4096 Jul 10 16:38 wordpress-seo
drwxrwx---  7 myuser www-data 4096 Jul 24 17:14 wp-minify

3 s
3

If you add the following to your wp-config.php file it will force WordPress to use the ‘direct’ filesystem method:

define( 'FS_METHOD', 'direct' );

Leave a Comment