What would be my best file permissions arrangement?

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/

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/ . 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?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.