So, here's my problem. Due to the Nginx is setup on my server I'm constantly having to switch permissions back and forth between ubuntu and nginx user IDs.

For updates to work in WordPress nginx needs to have full permissions.

For FTP access ubuntu needs to have full permissions.

When permissions are given to one, the other stops working. So I can either have FTP access or have updates working in WordPress and not both.

I've tried creating a group and setting full permissions for the group but couldn't get it to work.

Both the nginx user and the ubuntu user are in the nginx group, and the nginx group seems to have permission to the main directory (recursively - or at least I'm assuming so!)

ls -l /var/www results in:

total 6104
-rw-r--r--  1 nginx nginx     418 Dec 19  2014 index.php
-rw-r--r--  1 nginx nginx 6054753 Nov 20  2014 latest.tar.gz
-rw-r--r--  1 nginx nginx   19930 Feb 19  2015 license.txt
-rw-r--r--  1 nginx nginx    5633 Jul 14 11:43 nginx.conf
-rw-r--r--  1 nginx nginx    1559 Dec 16  2011 nginx_signing.key
-rw-r--r--  1 nginx nginx    7360 Sep 15 19:22 readme.html
-rw-r--r--  1 nginx nginx    4951 Dec 19  2014 wp-activate.php
drwxr-xr-x  9 nginx nginx    4096 Nov 20  2014 wp-admin
-rw-r--r--  1 nginx nginx     271 Dec 19  2014 wp-blog-header.php
-rw-r--r--  1 nginx nginx    5007 Apr 24 16:18 wp-comments-post.php
-rw-r--r--  1 nginx nginx    2764 Aug 20 10:13 wp-config-sample.php
drwxr-xr-x 10 nginx nginx    4096 Sep 20 15:12 wp-content
-rw-r--r--  1 nginx nginx    3286 Aug 20 10:13 wp-cron.php
drwxr-xr-x 12 nginx nginx    4096 Aug 20 10:13 wp-includes
-rw-r--r--  1 nginx nginx    2380 Dec 19  2014 wp-links-opml.php
-rw-r--r--  1 nginx nginx    3123 Apr 24 16:18 wp-load.php
-rw-r--r--  1 nginx nginx   34669 Aug 20 10:13 wp-login.php
-rw-r--r--  1 nginx nginx    8252 Dec 19  2014 wp-mail.php
-rw-r--r--  1 nginx nginx   11062 Aug 20 10:13 wp-settings.php
-rw-r--r--  1 nginx nginx   25124 Aug 20 10:13 wp-signup.php
-rw-r--r--  1 nginx nginx    4035 Dec 19  2014 wp-trackback.php
-rw-r--r--  1 nginx nginx    3055 Aug 20 10:13 xmlrpc.php

groups nginx results in:

nginx : nginx

groups ubuntu results in:

ubuntu : nginx adm dialout cdrom floppy sudo audio dip video plugdev netdev

Refreshing the group's permissions using chgrp -R nginx /var/www doesn't seem to do anything.

I'm not overly experienced at this sort of thing, and will be employing someone better qualified to take care of it in short order.

Until then, would any kind soul in the community be able to make any recommendations?

  • As an aside, you shouldn't be adding files directory to the /var/www directory. You should create a directory within it with an appropriate name and then play with the permissions on that directory due to security reasons. /var/www is a system directory. – codehitman Sep 21 '15 at 17:19

I seem to have answered my own question!

It seems that the directory in question belonged to the group, but didn't have the same permissions as the owner.

I ended up using chmod g=u /var/www to give the group the same permissions as the user, and that seems to have done the trick!

|improve this answer|||||

usermod -a -G nginx user add the ftpuser to group nginx

chmod -R g=u /var/www this did the trick for me in the same problem.

on CentOs or Fedora nginx doesn't use "www-data" but "nginx" as default group and most tutorials on internet work with www-data so it might be a bit confusing.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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