What are permissions so WP doesn't ask for FTP credentials?

What are the correct permissions so WP doesn't ask for FTP credentials if installing plugin?

My nginx user is www-data. If I do su www-data I can create both file and directory.

But when installing plugin I am asked for FTP credentials.

I tried to give the public_html directory 777 permissions for a while to test if I can install plugin without providing FTP credentials but it didn't help either.

* WP 3.2.1

nginx

ubuntu</list> 

How can I install plugins without providing FTP credentials.

14 Replies

Try

> chown -R www-data /path/to/example.com/public

Works for me

> chown -R www-data /path/to/example.com/public

the owner is jarda and group is www-data. I believe it should work under such setup.

what user is php (assuming you're running php-fpm) running as? that's who needs write access to the files/folders.

@bjl:

what user is php (assuming you're running php-fpm) running as? that's who needs write access to the files/folders.

I installed Nginx and PHP-FastCGI following http://library.linode.com/web-servers/n … 0.04-lucid">http://library.linode.com/web-servers/nginx/php-fastcgi/ubuntu-10.04-lucid and there is in my config.

FASTCGI_USER=www-data

The user of public_html is jarda and the group for the directory and its subdirectories is either www-data or git. Both groups have the user www-data as a member.

Strange is that ever 777 of the whole public_html won't solve the problem….

If memory serves wordpress needs to have it's files owned by the php user, even if it's writable if it's not the owner it won't go for it. a chown -R www-data /path/to/installation should fix it.

@obs:

If memory serves wordpress needs to have it's files owned by the php user, even if it's writable if it's not the owner it won't go for it. a chown -R www-data /path/to/installation should fix it.

hm,

I have ssh jail for that public_hmtl directory so I didn't want to change the owner as I am not sure if the ssh jail will work. But I wanted to try what you said.

And you are right. The files must be owned by php user.

Thank you for your help

R

Just change them when you need to upgrade then change them back when done, that's what I do.

Change the group of all files/directories to www-data:

chgrp -R www-data wordpress/

Then change the permissions of all files to 664 and all directories to 775 (this gives www-data the same permission that you'd have).

find wordpress/ -type d -exec chmod 775 {} \;
find wordpress/ -type f -exec chmod 664 {} \;

And last, add this line to your wp-config.php:

define('FS_METHOD', 'direct');

@Fangs404:

permissions of all files to 664 and all directories to 775 (this gives www-data the same permission that you'd have).

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


Typo alert. That code doesn't do what you say it does 8)

If www-data is already assigned as the group, chmod -R g+w /path/to/wordpress should work just fine.

If all else fails, you may need to tell WordPress it can do it:

/**
 * WordPress doesn't understand that PHP-FPM can write to disk.
 */
add_filter('filesystem_method', 'nginx_make_filesystem_direct');
function nginx_make_filesystem_direct() {
  return 'direct';
}

@hybinet:

@Fangs404:

permissions of all files to 664 and all directories to 775 (this gives www-data the same permission that you'd have).

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


Typo alert. That code doesn't do what you say it does 8)

If www-data is already assigned as the group, chmod -R g+w /path/to/wordpress should work just fine.

Whoops! Fixed.

There is a simple way round all of this and I just can't remember it :( I transferred my WP site across from shared hosting to an existing nginx Linode and made one tiny change and there was no need to worry about FTP. I think it was a one-liner chown or chmod or something like that. Chown I think for www-user?

Try googling it - I eventually found it and it was a hell of a lot easier typing one line than changing nginx or FTP. Chown -R something… sure it was…

@tentimes:

There is a simple way round all of this and I just can't remember it :( I transferred my WP site across from shared hosting to an existing nginx Linode and made one tiny change and there was no need to worry about FTP. I think it was a one-liner chown or chmod or something like that. Chown I think for www-user?

Try googling it - I eventually found it and it was a hell of a lot easier typing one line than changing nginx or FTP. Chown -R something… sure it was…

chown -R www-data /path/to/wordpress

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct