Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

I have a wordpress copy installed on /home/username/public_html/site, and now the problem is :

  1. Nginx running PHP with "www-data" identity
  2. The site folder owner and group are "username", not "www-data"
  3. So wordpress had no permission to create folder
  4. I changed owner and group of "site" to "www-data", wordpress is working ok
  5. But ftp can't create a folder - ftp is login as username/pass

Is it possible to have a /home/username/public_html/site, and both working on PHP side and ftp side. Any advice is appreciated!

share|improve this question

I found how to solve it, not a elegant way :

  1. change "user" primary group to "www-data"
  2. change /etc/vsftpd.conf and ~./bashrc, add local_mask = 002 to the first one, and umask = 002 to the last one

Now when I uploaded a file, by default it had permission rw-rw-r-, if its a folder rwxrwxr--, the owner is "user", and group is "www-data", and PHP is running with identity "www-data", so it can delete all files and folders uploaded from ftp.

share|improve this answer

Changing user primary group to "www=data" could work, but may be insecure in some cases. Adding umask option could be much more likely unsecure.

I would recommend little more complicated aproach, which may have some performance effect, but could be setup more securily: http://themesforge.com/performance/configuring-nginx-php5-fpm-and-user-permissions/

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.