What would be my best file permissions arrangement?

June 30, 2015 750 views
LEMP Miscellaneous Ubuntu

Ubuntu 14.04 LTS
LEMP Stack

I'm keeping my VPS simple with the LEMP stack, and I'm running my sites out of my user directory: /home/user1/domain1.com/public

In order to allow WordPress to upload & edit files, I find I have to assign www-data:www-data to all the website files.

Now I want to add a second user (who is less server savvy than me, but still knows FTP) and their user directory is: /home/user2/domain2.com/public . Again I need to assign www-data:www-data to allow their WordPress site to edit/upload files, however because they also use SFTP, by changing the user they no can no longer upload/edit files through SFTP.

So what would be the best user permissions to set to allow www-data to work, but also let them use SFTP to modify files?

1 Answer

This question gets asked quite a bit in one form or another.

Personally, I like to keep my web folders in /var/www/somewebsite

Then, I use this method:


to mount the needed web-folder into different users home folder. Works great, keeps permissions from getting tangly, and keeps everyone in their own home folder.

It is a long read, but quite easy to set up. Took me about 5 ~ 10 minutes to have it all working.

Have another answer? Share your knowledge.