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!


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.


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/

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.