简体   繁体   中英

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?

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM