I'm reasonably inexperienced with Linux/Ubuntu and struggling with what I thought would be a fairly simple permissions question. I'm running into problems where log files are being created as two different users, which can cause writing issues depending on which user wrote to it first, even though they are in the same group.
Users:
server user belongs to the www-data group
www-data user also belongs to the www-data group
When the log file is created, it has permissions of 644 (-rw-r--r--). So the user can write to it, but the group cannot.
So what happens is server will write to it first, but then www-data cannot, or vice versa.
In Ubuntu, is there any way to:
- Give two users full write access to a folder overriding the file permissions?
- Change the permissions when default files are created in a folder?
Details:
- Ubuntu 16.04.2 LTS
- It's a PHP/Laravel application running under Apache. But there are also command line tools, cron jobs, etc. that all end up writing to the log file once they call into the Laravel infrastructure. So it seems to be random chance on which one writes to the file first.
- I did see this post (How can I set the default permissions for files uploaded by apache2?) about using umask, but I hope that isn't the only solution. I don't want to change how everything is created in Apache just for the log files. Feels like using a hammer to kill an ant.
No comments:
Post a Comment