On 11 November 2010 16:54, Chris G cl@isbd.net wrote:
I want to enable two users to write to a specific hiearchy of files and I really can't see an easy way to do it.
To be specific I have a hierarchy of files making up the data files of a wiki which I (mostly) edit directly but also need to be able to edit in the normal wiki fashion. Thus they need to be writeable by the apache2 process (which is user www-data) and directly by the user (which is me, user chris).
Can anyone suggest a way to allow these to be writeable by both users? When a user creates a new file it must be editable by the other user as well so simply creating a common group to which both users belong won't work as, in general, the umask won't give files user write permission.
I can suggest two ways, depending on what your distro supports:
1. You can set the sticky bit on the group so that all the files created in the directory are owned by the group rather than the user: i.e. 'chmod 2660 TheDir' The 2 sets the sticky bit for the group, replace the 660 with whatever you need.
2. You could use ACLs in addition to the normal User, Group, Other permissions. These can also be set to inherit so that new files created get the same permissions?