WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question

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' );
share|improve this answer
Bingo! This worked for me. – Ezequiel Muns Apr 7 '15 at 14:06
Why wordpress can't allow the apache user be a member of a group that has group write and let the wordpress folder be owned be someone other than the apache user is beyond me. This gets around that. Awesome! – frumbert Nov 30 '15 at 1:59

I think, I've answered a similar question here before. OP claims all file permission are set correctly but still ask for ftp credentials.

Well, this is very weird. But I think, it is still about permission.

Wordpress will write a temp file and compare the file owner by getmyuid() == @fileowner($temp_file_name).

If ture, it'll install the plugin directly without asking ftp details.

For more details, wp-admin/includes/file.php and get_filesystem_method function.

So, I would suggest you, write an independent php script in the root folder of wordpress installation to check out.

1, write a temp file

2, check the owner of the temp file

$dir = dirname(__FILE__);

$temp_file = $dir.'/wp-content/'.time();
$temp_handle = fopen($temp_file, 'w');
if ( $temp_handle ) {
    if ( getmyuid() == fileowner($temp_file) ){
        echo 'file owner correct';

    echo 'cant write file';
share|improve this answer
Maybe my default permissions are wrong? I'll check. – pate Aug 5 '13 at 2:13
So WordPress is checking the result of getmyuid(), which should be www-data against the owner of a newly created file, which would be myuser, not www-data. Looks like the only way this would work without modifying WordPress code is to chown everything to www-data, or to run Apache under myuser. Any ideas? – pate Aug 5 '13 at 2:25
You may want to run Apache under myuser rather than hacking wordpress core php – Jesse Aug 5 '13 at 2:29
It gets weirder. If I put that code in a PHP file and run it under my WordPress folder, it works and I can output the result of getmyuid() and the temp file owner both as 33 (for www-data), so I should not be prompted for FTP details. – pate Aug 5 '13 at 2:45

Simple workaround would be to add FTP credentials inside wp-config.php file, like this:

define( 'FTP_USER', 'username' );
define( 'FTP_PASS', 'password' );
define( 'FTP_HOST', 'ftp.example.org:21' );

But the problem might be related to your hosting using some different PHP process instead of suPHP.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.