How to end up with the right file/folder ownership of log files (root vs www-data)

Posted 1 year ago by matthewpennell

I am working on a web app, which has a frontend and a bunch of regular jobs. The jobs are created by the Laravel Task Scheduler, and then the queue is processed by the Laravel Queues worker via Supervisor.

The problem I'm having is that the daily log files (/storage/logs/laravel-YYYY-MM-DD.log) are being created by user root with very limited read/write permissions, which then means that the www-data user (i.e. the user that executes the code during web requests) can't write to the log and I get errors.

The cron job that calls the task scheduler is running as www-data, but whatever I do I can't make the new daily log file be created by the right user.

Any suggestions?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.