0

using: openSUSE Leap 42.2

/etc/cron.d/mysite file content:

* * * * * wwwrun /usr/bin/php /srv/www/mysite/cron.php >> /var/log/apache2/mysite.cron 2>&1

/etc/cron.d/ dir content:

/etc/cron.d # ls -ls
total 12
4 -rw------- 1 root root 142 May  7  2018 autologout
4 -rw-r--r-- 1 root root 289 Jan  8 14:33 mysite
4 -rw------- 1 root root 369 May  7  2018 seccheck

mail message:

Message 103:
From wwwrun@linux.suse  Wed Jan  8 18:52:01 2020
X-Original-To: wwwrun
Delivered-To: wwwrun@linux.suse
From: "(Cron Daemon)" <wwwrun@linux.suse>
To: wwwrun@linux.suse
Subject: Cron <wwwrun@mysite1> /usr/bin/php /srv/www/mysite/cron.php >> /var/log/apache2/mysite.cron 2>&1
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <XDG_SESSION_ID=312343>
X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/11>
X-Cron-Env: <LC_CTYPE=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/var/lib/wwwrun>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=wwwrun>
X-Cron-Env: <USER=wwwrun>
Date: Wed,  8 Jan 2020 18:52:01 +0100 (CET)

/bin/sh: /var/log/apache2/mysite.cron: Permission denied

mysite.cron log file

ls -la /var/log/apache2/mysite.cron
-rw-rw-rw- 1 wwwrun www 953 Jan  8 14:08 /var/log/apache2/mysite.cron

How to fix this?

Executing

/usr/bin/php /srv/www/mysite/cron.php >> /var/log/apache2/mysite.cron 2>&1

from terminal as root, executes well, without permission error.

2
  • I don't have a SUSE instance handy, but I wonder if SELinux is enabled & enforcing?
    – Jeff Schaller
    Jan 8 '20 at 18:15
  • selinux policy is not installed
    – klor
    Jan 8 '20 at 18:20
0

Perfect solution is available here: https://serverfault.com/a/998176/302842

Thanks to Cameron Kerr (@cameron-kerr)!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.