8
2
I'm more a Windows person, so please excuse my ignorance with this basic Linux question.
I am looking after a Linux (Debian) server which only has Apache2 and vsftp installed on it.
What is happening is that I am having a constant battle with who owns files and folders and can't seem to get it right.
This is my understanding so far:
- www-data user needs ownership of folders and files as all of the files under /var/www/html run scripts which require them to write to their folder. And of course it needs to be able to serve the pages via http.
- My ftp user (lets call it ftpuser) also requires permission to write to the /var/www/html folder (recursive) as I need to be able to upload new files.
With this in mind I have created a group called ftpandwww and have chowned all the folders and files to this group. This has worked to a degree...
I'm nearly in the right place, except for the fact that any new folders created using my FTP client have the wrong permissions (which I can correct by changing them under FTP client), but then www-data can't write to them because they are owned by ftpuser and I end up having to SSH in and running a chown to ftpandwww group so that they are both happy.
How do I make all the new folders that I create under FTP have the correct permissions (774) and be automatically owned by ftpandwww group to that I can upload and serve via web (with write permissions) without having to go in and chown all the new folders and files each time?
Related: http://unix.stackexchange.com/questions/1314/how-to-set-default-file-permissions-for-all-folders-files-in-a-directory
http://stackoverflow.com/questions/580584/setting-default-permissions-for-newly-created-files-and-sub-directories-under-a
http://unix.stackexchange.com/questions/115631/getting-new-files-to-inherit-group-permissions-on-linux