DevHeads.net

How to allow easy editing of www-data owned files by a user

I've been trying to find a good solution to this problem for *years*
but I'm still hitting problems with it. The current problem is that
syncthing doesn't deal well with directories and files which have
different owners on different systems.

The essential problem is that web files which are manipulated by
apache need to be owned by www-data but I want to be able to edit
these files as well. In particular I have a wiki where I sometimes
edit the files using the wiki (ownership ends up as www-data) and
sometimes I edit them directly with an editor (ownership ends up as
chris).

Currently I use access control lists (setfacl) to make things so that
both chris and www-data can both manipulate files in the wiki
directory regardless of whether they are owned by chris or www-data
but this isn't a perfect solution as the correct settings don't always
get put on new files.

What I really need is:-

All the wiki files are owned by 'chris' (the wiki is rooted in my
home directory and is synchronised across a couple of machines by
syncthing).

www-data can read/write/create files in the ~/chris/wiki directory
but they will always be owned by 'chris'.

Can anyone see a way of implementing this? ... or any other
reasonable solution?