I have looked at multiple questions about this issue and very few are resolved.
Basically I want to allow both my user and apache (www-data) to modify a file without using chmod 777
permissions.
I added my user to the www-data
group and the www-data
user to my user group. Using id
and group
on my user and the www-data
user shows both are in each others group.
The file in question is located in /home/myuser/workspace/project/logs/log.txt
and its permissions are 644
- myuser:www-data
with the folder it is in as 755
- myuser:www-data
This allows my application to write to the file (under my user) but apache cannot access the file. When I swap user permissions around myuser:www-data
-> www-data:myuser
then apache can access the file but my application cannot write to the file.
I have no idea what I am overlooking.