User permissions

Hi,

I successfully installed everything on my ubuntu linode (nginx, php-fpm etc) for my wordpress website.

I created additional user "someuser", disabled root login, and password authentication. By following themesforge tutorial - I did chown of my site folder, and owner of site files is www-data.

That's ok, wp works, I can install plugins, update plugins, but I can't do anything with my FTP, cause my user "someuser" is not owner of the files. I get that.

If I chown site files, and file owner is my "someuser" instead of www-data, I can edit files via FTP, but wp updates, plugin installations are not working.

How can I solve this? I want to be able to use FTP and WP to be able to install plugins from backend?

4 Replies

I don't know about nginx, but on apache here's what we do:

USER / GROUP

someuser / www-data ~~ for the site's main directory (/var/www/someuser)

someuser / www-data ~~ for the site's content directory (/var/www/someuser/mysite.com)

someuser / someuser ~~ for all the files in the site we want available for SFTP.

For files we don't want to be available to SFTP we change the user to another user.

1. chmod 711 /home/someuser

2. chown -R someuser:someuser /home/someuser

3. chmod -R 755 /home/someuser/*

Then, go into the WordPress directory and chmod -R 775 any plugins folders or anything you need writable specifically.

You should also go add someuser in as a worker in nginx.conf (then restart):

http://forum.nginx.org/read.php?11,2664,2684

The configuration you have with someuser:www-data should work, so that leads me to think it's just a chmod permissions issue. I just find it easier to maintain when all of the files in a /home/user folder are owned by user.

Hope this assists. :-)

You should create a group, add yourself to that group, and set the files to be owned by www-data and that group. Don't use sudo. It needs to be another group that you make that isn't related to requiring use of sudo.

Or you can add www-data to your group (e.g., group 'someuser').

Then, when you want a directory, or file, to be writable by www-data, you simply make it group-writable. This you can do via SSH or FTP as user 'someuser'. An ordinary user can modify directory/file permissions but cannot change ownership.

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