I use Geany to edit files in a web app that resides in
/var/www. The owner and group of
/var/www and all sub directories and files are
www-data:www-data. My user account is a member of that group and I edit the files as my user. Sometimes it seems Geany changes the owner and group of the edited file to my user and my group.
How can I make sure the user:group is never changed when I edit a file with Geany?
I found this clue in the Geany help:
Defines the mode how Geany saves files to disk. If disabled, Geany directly writes the content of the document to disk. This might cause loss of data when there is no more free space on disk to save the file. When set to true, Geany first saves the contents into a temporary file and if this succeeded, the temporary file is moved to the real file to save. This gives better error checking in case of no more free disk space. But it also destroys hard links of the original file and its permissions (e.g. executable flags are reset). Use this with care as it can break things seriously. The better approach would be to ensure your disk won't run out of free space.
As of now it's disabled, meaning that the file is written directly, which I thought would prevent my problem from happening.
This questions contains some relevant info: How do I edit a file and preserve its access control list / SELinux security context?