I guess so, though I can't imagine when or why I would have done so, particularly to an owner/group ID which doesn't actually exist on my system! Here's what I see inside /var/www/clients. Code: root@foo:/var/www/clients# ls -la total 12 drwxr-xr-x 3 root root 4096 Sep 12 2022 . drwxr-xr-x 8 root root 4096 Oct 9 2022 .. drwx--x--x 4 1054 1056 4096 Oct 10 2022 client1 root@foo:/var/www/clients# cd client1/ root@foo:/var/www/clients/client1# ls -la total 16 drwx--x--x 4 1054 1056 4096 Oct 10 2022 . drwxr-xr-x 3 root root 4096 Sep 12 2022 .. drwxr-x--- 3 1054 1056 4096 Nov 9 2022 host.example.com drwxr-xr-x 17 root root 4096 Oct 1 2022 web1 root@foo:/var/www/clients/client1# ls -la host.example.com/ total 16 drwxr-x--- 3 1054 1056 4096 Nov 9 2022 . drwx--x--x 4 1054 1056 4096 Oct 10 2022 .. -rw-r--r-- 1 1054 1056 281 Oct 7 2022 .htaccess drwxr-xr-x 3 1054 1056 4096 Oct 5 2022 .well-known lrwxrwxrwx 1 root root 30 Nov 9 2022 web1 -> /var/www/clients/client1/web1/ root@foo:/var/www/clients/client1# ls -la web1/ total 948 drwxr-xr-x 17 root root 4096 Oct 1 2022 . drwx--x--x 4 1054 1056 4096 Oct 10 2022 .. drwx------ 2 web1 client1 4096 Sep 12 2022 .ssh drwxr-xr-x 2 root root 4096 Oct 8 2022 backup lrwxrwxrwx 1 root root 7 Oct 1 2022 bin -> usr/bin drwxr-xr-x 2 web1 client1 4096 Sep 12 2022 cgi-bin drwxr-xr-x 2 root root 4096 Oct 1 2022 dev drwxr-xr-x 7 root root 4096 Oct 2 2022 etc drwxr-xr-x 4 root root 4096 Oct 1 2022 home lrwxrwxrwx 1 root root 7 Oct 1 2022 lib -> usr/lib lrwxrwxrwx 1 root root 9 Oct 1 2022 lib64 -> usr/lib64 drwxr-xr-x 2 root root 4096 Oct 20 02:04 log drwx--x--- 3 web1 client1 4096 Oct 20 02:04 private drwxr-xr-x 3 root root 4096 Oct 1 2022 run drwxr-xr-x 2 root root 4096 Sep 30 2022 ssl drwxrwxrwx 3 web1 client1 901120 Oct 20 11:08 tmp drwxr-xr-x 7 root root 4096 Oct 1 2022 usr drwxr-xr-x 4 root root 4096 Oct 1 2022 var drwx--x--x 14 web1 client1 4096 Oct 17 12:55 web drwx--x--- 2 web1 client1 4096 Sep 12 2022 webdav root@foo:/var/www/clients/client1# After chowning everything which shows 1054:1056 to root:root, the jk_init command runs successfully. We'll see now about the cron job.
The cron job now runs, but a database-related error from Nextcloud appears inside cron.log. Code: Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory in /web/lib/private/DB/Connection.php:140
Have you configured it to use IP 127.0.0.1 instead of localhost already? You can not connect to localhost mysql in a jail, as localhost is the mysql socket, and this is not reachable from within the jail as its outside of the jail. You must configure the software to use IP 127.0.0.1 to connect to the mysql database instead.
I hadn't, but I have now. Should I use /usr/bin/php8.2, or the "copy" /var/www/clients/client1/web1/bin/php8.2?
/usr/bin/php8.2 is /var/www/clients/client1/web1/bin/php8.2 when seen from insid ethe jail, as /var/www/clients/client1/web1/ folder becomes / So when you execute a command in the jail, you must use /usr/bin/php8.2
I guess the usr part is taken out? It does run now, although with a new error: Code: {"reqId":"9krebxKiw5o4X2LAnpkL","level":2,"time":"2023-10-20T12:55:02+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Temporary directory /var/www/clients/client1/web1/tmp/nextcloud-tmp is not present or writable","userAgent":"--","version":"27.1.2.1","data":[]} The directory /var/www/clients/client1/web1/tmp/nextcloud-tmp does exist: Code: # ls -la /var/www/clients/client1/web1/tmp/nextcloud-tmp total 888 drwxrwxr-x 2 web1 client1 4096 Oct 18 10:57 . drwxrwxrwx 3 web1 client1 901120 Oct 20 15:18 .. So, /var/www/clients/client1/web1/tmp is world-writable, but /var/www/clients/client1/web1/tmp/nextcloud-tmp is not. But, isn't the cron job running as user web1?
If my tempdirectory is /var/www/clients/client1/web1/tmp/nextcloud-tmp (in Nextcloud's config.php), then what does that become when run in the jail? Does the jailed cron job end up looking in the wrong place for that directory?
Please see my explanation in post #27: /var/www/clients/client1/web1/ becomes / in the jail. So when you take the path /var/www/clients/client1/web1/tmp/nextcloud-tmp and replace /var/www/clients/client1/web1/ with /, then the path inside the jail is /tmp/nextcloud-tmp
Maybe you should consider running it just as a non-jailed cronjob and then learn more about jails and how they work and test it with a simpler project.
@till, thanks for trying to help me. I think you're completely right and I'm setting on the cronjob for user web1 using a regular crontab entry and will see how that goes. It's obviously true that I'm not familiar enough with jails to understand the nature of the problem. The confusing thing is that it used to work as-is. I have no earthly idea what, if anything, I changed which caused it no longer to work. For posterity, the jist of the problem, which will remain for future investigation by me, is that, when run in the jail, the cron job is unable to "find" the datadirectory and tempdirectory. For the former, it claims to be unable to find the ".ocdata" file which is definitely present in the actual datadirectory, and is simply unable to find or write to the tempdirectory at all.