85 reputation
119
bio website twitter.com/charlesroper
location United Kingdom
age 39
visits member for 2 years, 2 months
seen yesterday
Just a biodiversity tech-dude working for a Local Biodiversity Record Centre, near Brighton, UK.

Nov
9
awarded  Famous Question
Feb
21
awarded  Notable Question
Jan
25
revised SFTP permission denied on files owned by www-data
edited body
Dec
21
awarded  Popular Question
Oct
10
revised SFTP permission denied on files owned by www-data
Major update, with answer to original Q and an updated permissions strategy.
Oct
9
comment SFTP permission denied on files owned by www-data
Thanks Marty. This part from the Apache Cookbook made me laugh: "You should be aware that if you ask 12 people for the correct ways to set file permissions on your Apache server, you will get a dozen different answers." You've given me most everything I need to make progress now. Thank you so much for your time. :-)
Oct
9
awarded  Benefactor
Oct
9
awarded  Scholar
Oct
9
accepted SFTP permission denied on files owned by www-data
Oct
8
comment SFTP permission denied on files owned by www-data
Update: I asked on the httpd IRC channel and someone provided the canonical advice. So in my case I need to also add Apache to webmasters so that it may read files and chown the files to myself so that I may edit them. If I need to give additional users write permissions, I'll need to use ACLs.
Oct
8
awarded  Excavator
Oct
8
awarded  Editor
Oct
8
revised How to remove a user from a group?
Slight tidy of text to improve readability.
Oct
8
comment SFTP permission denied on files owned by www-data
Actually, another clarification needed: if I make files in /var/www owned by webmasters, how will Apache read those files? Presumably I don't want to add Apache to webmasters because then I'm back in the same situation of Apache having overly permissive permissions.
Oct
8
suggested suggested edit on How to remove a user from a group?
Oct
8
comment SFTP permission denied on files owned by www-data
Just one clarification needed if that's okay? The files and directories that need to be writable by Apache, should they be owned by www-data and not webmasters?
Oct
7
comment SFTP permission denied on files owned by www-data
Update: I'm also going to work with the other devs to ensure only those files and directories that require write permission have write permission, otherwise all files within /var/www will be set to read-only for the www-data group.
Oct
7
revised SFTP permission denied on files owned by www-data
Added apache tag
Oct
7
comment SFTP permission denied on files owned by www-data
And I do need to give other users access to /var/www so I thought giving group access to www-data and making everyone a member of that group would be a good solution. I can see now the problem of Apache being able to overwrite any file in there, though. Given only 2 devs (which includes myself) have access to the code, it's relatively safe in the short term.
Oct
7
comment SFTP permission denied on files owned by www-data
Hi @marty-fried, thanks for the answer, it gives me plenty to try out. Re. your questions. I pieced the info together from various sources (hence why I wrote it down into my own-use guide) and can't remember the exact source. Although I didn't use this particular source (solution 1) (I only just found it), it gives a good rationale for my decision. In the Apache guide you mention, it recommends creating a group called 'webmasters', but if I did that, how would Apache write to the /var/www without also adding it to that group?