Cron not working on ubuntu 22.04

i have search & red other support request & the solutions did not work for me

im getting this error when i try to run the command in terminal

sudo -u www-data php -f /var/www/nextcloud/cron.php


Console has to be executed with the user that owns the file config/config.php
Current user id: 33
Owner id of config.php: 0

the nextcloud folder is owned by www-data user

this is my crontab -u www-data -e file command

*/1 * * * * php -f /var/www/nextcloud/cron.php

running on a VM on ubuntu 22.04

nextcloud version [Nextcloud Hub 4 (26.0.0)
php version 8.1

how can i resolve this

Looks like your config.php is owned by root instead of www-data. You can check by using the following command…

ls -l /var/www/nextcloud/config/config.php

…and fix it, if necessary, with this command:

chown -R www-data:www-data /var/www/nextcloud

Tx this solved the problem

1 Like