Kezern
Kezern

Reputation: 473

Log file is being created with root user

I have setted a cron using schedule funcion in kernel.php file of laravel. It is calling a method which is writing logs.

My problem is log file is created with root user. Can I set the permissions of the file or execute that cron with a certain user?

Upvotes: 0

Views: 1126

Answers (1)

Stefano
Stefano

Reputation: 178

You can change the file permission with the user you want with this command:

cd path-to-log-folder && chown your-user:your-group file-name


Otherwise, you can set the cronjob run by a specific user with this command:

crontab -u your-user -e

and change the ownership of your log file with the same user (I prefer this way).

Upvotes: 1

Related Questions