Error: NotPermittedException Could not create folder "/appdata_ocXXXXX/preview/8/b/d/e/8/a/c/554139"

Nextcloud version (eg, 20.0.5): 28.0.1
Operating system and version (eg, Ubuntu 20.04): Debian 12
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.57 (Debian)
PHP version (eg, 7.4): 8.2.7
MariaDB : 11.2.2
The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. go to the “Photos” application
  2. Nextcloud generate thumbnails on new videos or photos
  3. go to the “logging” nenu and the errors are displayed

The output of your Nextcloud log in Admin > Logging:

[index] Erreur: Could not create folder "/appdata_oc5874yoce7r/preview/8/b/d/e/8/a/c/554139"
	GET /apps/photos/api/v1/preview/554139?etag=4c27f49683742f0189a49edc14592fe9&x=512&y=512
	de 192.168.1.254 par Boubou à 18 janv. 2024, 09:22:31

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'ocXXXXXXXXX',
  'passwordsalt' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'secret' => 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  'trusted_domains' => 
  array (
    0 => '192.168.1.6',
    2 => 'nextcloud.XXXXXXXXX.cloud',
    1 => 'www.nextcloud.XXXXXXXXX.cloud',
  ),
  'datadirectory' => '/mnt/ssd_2To/nextcloud',
  'dbtype' => 'mysql',
  'version' => '28.0.1.1',
  'overwrite.cli.url' => 'https://nextcloud.XXXXXXXXX.cloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'XXXXXX',
  'dbpassword' => 'XXXXXXXXXXXXXXXXXXXX',
  'installed' => true,
  'default_phone_region' => 'FR',
  'htaccess.RewriteBase' => '/',
  'trashbin_retention_obligation' => 'auto, 1',
  'filelocking.enabled' => 'true',
  'knowledgebaseenabled' => false,
  'activity_expire_days' => 1,
  'skeletondirectory' => '/var/www/nextcloud/skeleton/',
  'maintenance' => false,
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => '0',
    'timeout' => '0.0',
  ),
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'nextcloud',
  'mail_domain' => 'XXXXXXXXXX.cloud',
  'mail_smtphost' => 'mail.XXXXXXXXXXXX.cloud',
  'mail_smtpport' => '465',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'nextcloud@XXXXXXXXXX.cloud',
  'mail_smtppassword' => 'XXXXXXXXXXXXXXXXXXXX',
  'updater.release.channel' => 'stable',
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\Image',
    1 => 'OC\\Preview\\HEIC',
    2 => 'OC\\Preview\\TIFF',
    3 => 'OC\\Preview\\Movie',
    4 => 'OC\\Preview\\PNG',
    5 => 'OC\\Preview\\JPEG',
    6 => 'OC\\Preview\\GIF',
    7 => 'OC\\Preview\\BMP',
    8 => 'OC\\Preview\\XBitmap',
    9 => 'OC\\Preview\\MP3',
    10 => 'OC\\Preview\\MP4',
    11 => 'OC\\Preview\\TXT',
    12 => 'OC\\Preview\\MarkDown',
    13 => 'OC\\Preview\\PDF',
    14 => 'OC\\Preview\\Krita',
    15 => 'OC\\Preview\\OpenDocument',
  ),
  'preview_max_x' => 1024,
  'preview_max_y' => 1024,
  'theme' => '',
  'loglevel' => 2,
  'app_install_overwrite' => 
  array (
    0 => 'backup',
    1 => 'files_rightclick',
    2 => 'metadata',
    3 => 'otpmanager',
    4 => 'files_retention',
  ),
);

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

{"reqId":"YcY7FCz1j7Nrhmaqp6KC","level":3,"time":"2024-01-18T08:21:59+00:00","remoteAddr":"192.168.1.254","user":"Boubou","app":"index","method":"GET","url":"/apps/photos/api/v1/preview/554483?etag=0a1fedd61d49871dee4c55dbede60b08&x=64&y=64","message":"Could not create folder \"/appdata_oc5874yoce7r/preview/4/b/8/6/5/6/2/554483\"","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","version":"28.0.1.1","exception":{"Exception":"OCP\\Files\\NotPermittedException","Message":"Could not create folder \"/appdata_oc5874yoce7r/preview/4/b/8/6/5/6/2/554483\"","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Files/AppData/AppData.php","line":147,"function":"newFolder","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Storage/Root.php","line":74,"function":"newFolder","class":"OC\\Files\\AppData\\AppData","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":607,"function":"newFolder","class":"OC\\Preview\\Storage\\Root","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":133,"function":"getPreviewFolder","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":110,"function":"generatePreviews","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/lib/private/PreviewManager.php","line":187,"function":"getPreview","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/apps/photos/lib/Controller/PreviewController.php","line":162,"function":"getPreview","class":"OC\\PreviewManager","type":"->"},{"file":"/var/www/nextcloud/apps/photos/lib/Controller/PreviewController.php","line":128,"function":"fetchPreview","class":"OCA\\Photos\\Controller\\PreviewController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"index","class":"OCA\\Photos\\Controller\\PreviewController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/Files/Node/Folder.php","Line":162,"message":"Could not create folder \"/appdata_oc5874yoce7r/preview/4/b/8/6/5/6/2/554483\"","exception":{},"CustomMessage":"Could not create folder \"/appdata_oc5874yoce7r/preview/4/b/8/6/5/6/2/554483\""}}
{"reqId":"leXd6FyQRT8IZMOkwuH5","level":3,"time":"2024-01-18T08:22:31+00:00","remoteAddr":"192.168.1.254","user":"Boubou","app":"index","method":"GET","url":"/apps/photos/api/v1/preview/554139?etag=4c27f49683742f0189a49edc14592fe9&x=512&y=512","message":"Could not create folder \"/appdata_oc5874yoce7r/preview/8/b/d/e/8/a/c/554139\"","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","version":"28.0.1.1","exception":{"Exception":"OCP\\Files\\NotPermittedException","Message":"Could not create folder \"/appdata_oc5874yoce7r/preview/8/b/d/e/8/a/c/554139\"","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Files/AppData/AppData.php","line":147,"function":"newFolder","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Storage/Root.php","line":74,"function":"newFolder","class":"OC\\Files\\AppData\\AppData","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":607,"function":"newFolder","class":"OC\\Preview\\Storage\\Root","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":133,"function":"getPreviewFolder","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":110,"function":"generatePreviews","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/lib/private/PreviewManager.php","line":187,"function":"getPreview","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/apps/photos/lib/Controller/PreviewController.php","line":162,"function":"getPreview","class":"OC\\PreviewManager","type":"->"},{"file":"/var/www/nextcloud/apps/photos/lib/Controller/PreviewController.php","line":128,"function":"fetchPreview","class":"OCA\\Photos\\Controller\\PreviewController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"index","class":"OCA\\Photos\\Controller\\PreviewController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/Files/Node/Folder.php","Line":162,"message":"Could not create folder \"/appdata_oc5874yoce7r/preview/8/b/d/e/8/a/c/554139\"","exception":{},"CustomMessage":"Could not create folder \"/appdata_oc5874yoce7r/preview/8/b/d/e/8/a/c/554139\""}}

Hi
I encounter this error which is random, sometimes when generating around fifty thumbnails there is no error and sometimes there are errors. and with the errors I don’t see any problem with the thumbnails, they are all displayed correctly.
Thanks for your help

appdata_oc5874yoce7r/
appdata_oc5874yoce7r/preview/

Can you confirm the above two folders exist in your /mnt/ssd_2To/nextcloud folder?

Anything unusual about file ownership or permissions?

hi
Yes I confirm it, look at the images

Hi
today I had this error again and yet the folder and the thumbnails are created… I don’t see where this could come from…

NotPermittedException
Could not create folder “/appdata_oc5874yoce7r/preview/5/7/2/8/a/1/a/735825”

and here is the folder created

I updated my Nextcloud server to version 28.0.2 and I still have these errors which appear every day. My Nextcloud files are on a 2TB SSD and
I use external storage (second disk in the server) with a 4TB ext4 disk to synchronize and store the video files from my cameras, and I have the impression that it is the procedure for generating thumbnails of the video files which creates this error, but yet they are created. I don’t know where to look to fix this problem anymore…

{
  "reqId": "mJFA4FXwbI8p3iXCv6xV",
  "level": 3,
  "time": "2024-02-03T21:11:34+00:00",
  "remoteAddr": "37.169.22.52",
  "user": "Boubou",
  "app": "index",
  "method": "GET",
  "url": "/apps/photos/api/v1/preview/816209?etag=8182189561c61c199f46b2bbad946b0e&x=64&y=64",
  "message": "Could not create folder \"/appdata_oc5874yoce7r/preview/8/8/b/4/f/2/9/816209\"",
  "userAgent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
  "version": "28.0.2.5",
  "exception": {
    "Exception": "OCP\\Files\\NotPermittedException",
    "Message": "Could not create folder \"/appdata_oc5874yoce7r/preview/8/8/b/4/f/2/9/816209\"",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/Files/AppData/AppData.php",
        "line": 147,
        "function": "newFolder",
        "class": "OC\\Files\\Node\\Folder",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Preview/Storage/Root.php",
        "line": 74,
        "function": "newFolder",
        "class": "OC\\Files\\AppData\\AppData",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Preview/Generator.php",
        "line": 607,
        "function": "newFolder",
        "class": "OC\\Preview\\Storage\\Root",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Preview/Generator.php",
        "line": 133,
        "function": "getPreviewFolder",
        "class": "OC\\Preview\\Generator",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Preview/Generator.php",
        "line": 110,
        "function": "generatePreviews",
        "class": "OC\\Preview\\Generator",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/PreviewManager.php",
        "line": 187,
        "function": "getPreview",
        "class": "OC\\Preview\\Generator",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/photos/lib/Controller/PreviewController.php",
        "line": 162,
        "function": "getPreview",
        "class": "OC\\PreviewManager",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/photos/lib/Controller/PreviewController.php",
        "line": 128,
        "function": "fetchPreview",
        "class": "OCA\\Photos\\Controller\\PreviewController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 230,
        "function": "index",
        "class": "OCA\\Photos\\Controller\\PreviewController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 137,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 184,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 315,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1069,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 39,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Files/Node/Folder.php",
    "Line": 162,
    "message": "Could not create folder \"/appdata_oc5874yoce7r/preview/8/8/b/4/f/2/9/816209\"",
    "exception": [],
    "CustomMessage": "Could not create folder \"/appdata_oc5874yoce7r/preview/8/8/b/4/f/2/9/816209\""
  },
  "id": "65beb0a900b61"
}

I can not say nothing about your issue in special exept that you should not take it too serious. It is possible, that it tries to create too much previews simultaniously and then it throws an error but after all, it corrects itself.

But I found this in your config.php:

The files_rightclick app is removed as of Nextcloud 28 as it is now part of the Files app. If you still install it using app_install_overwrite, it will install a very old version of this app and may cause many unexpected errors. You should remove it. Nextcloud 28 has so many changes that I would strongly discourage installing unsupported apps at all. Metadata can also cause problems and will not work at all. So please remove all unsupported apps and delete this part:

… from your config.php


Much and good luck,
ernolf

1 Like

Thank you for your help, I will follow your advice and wait a few days to see if there is any improvement.
Edit: on all applications, there was only OTP Manger installed, I had to try at one point these applications which modified my “config.php” file and when uninstalling the application it remained in the file configuration

I’ve now traced it back a little bit:

Here it tries to create the preview directory for the image with file_id 816209



Expand this, if you want to get the Hex-Tree in the appdata_$instanceid/preview folder explained

For performance reasons, these are created in a hex tree. This hex tree has a directory depth of 7, which is created with the first 7 digits of the md5 hash of the file_id.
So the md5 hash of 816209 is 88b4f290a9eacf2eb5cf67c99d369af6, so this file path is then created (with the first 7 digits): 8/8/b/4/f/2/9
and because this type of path assignment represents a pseudo-random distribution with 268,435,456 different folder paths, which ensures a good, balanced distribution of the tree, it is at risk of collision. But because the file_id is also appended to this path as a folder, the path is absolutely uniq and a large, evenly distributed tree is possible with relatively short paths.



This is the place in the code, that throws the error:

in this line:

if ($this->checkPermissions(\OCP\Constants::PERMISSION_CREATE)) {

… the method checks if the caller has permission to create folders.

the “PERMISSION_CREATE” constant is defined in master/lib/public/Constants.php#L45

if the caller does not have the “PERMISSION_CREATE” rights, a NotPermittedException "Could not create folder " is thrown.


So in this context you could check who owns the images and whether there are users (guests) in the cloud who don’t have write permissions but still get the images listed.


With this SQL query you can make the paths of the corresponding files visible:

SELECT CONCAT(oc_storages.id, oc_filecache.path) AS concatenated_path FROM oc_storages INNER JOIN oc_filecache ON oc_storages.numeric_id = oc_filecache.storage WHERE oc_filecache.fileid = $file_id;
(I’m assuming that you know how to get the SQL command line client)

replace $file_id at the end of the query with the file ID from your error messages (e.g. 816209 as in the last error message you posted)

By knowing the relevant files, you may be able to get a clearer picture of what the problem is. Whether it affects a user who only has limited permissions.
Maybe it’s an app that needs to be improved.


Much and good luck,
ernolf

3 Likes

Thank you for all these explanations,
I executed the SQL command with file ID 816209 as you indicated, in output we have a link to a file:
/mnt/wd_4TB/Réolink/Videos/02032024/PARKING-212802-212818.mp4

This file was created by a nextcloud user who uses a disk that is mounted in ext4.

I have no active Guest account on the server.
here is an overview of the rights to access this file
2

3
4
5
6

do you see anything incorrect? Thanks again for your time

Just to clarify. This is not about the write permissions on OS-level, which is completely given, but rather about the ACL rules at cloud level.
You should therefore check very carefully whether everyone who has read access to this file also has write access to that storage.

So it’s not necessary that you post all the screenshots of your graphical user interfaces here, but you should now keep a detailed account of all the files for which this error appears so that you might recognize a pattern at some point.

Do you have the Preview Generator app installed?

App-Id previewgenerator
App-Name Preview Generator
Summary A preview pre-generation app
Categories multimedia
App-Version 5.4.0
Repository GitHub - nextcloud/previewgenerator: Nextcloud app to do preview generation in the background.
Issue-Tracker https://github.com/nextcloud/previewgenerator/issues
PHP min/max 8.0 / 8.3
NC min/max 26 / 28
Not-shipped (not included) App available in appstore
Appstore Preview Generator - Apps - App Store - Nextcloud
Created 2016-12-07T10:01:33.940211Z
Last modified 2023-11-27T09:50:00.091902Z

This app can pre-generate the directories and thumbnails to speed up the loading of the preview images.


ernolf

Hi
to limit the display of errors “Error: NotPermittedException Could not create folder “/appdata_oc” I use a cron task every 10 minutes to generate the new thumbnails, because when it is executed with cron there is no 'errors. in the meantime it limits errors in the Nextcloud log
here is the cron job I run:

*/10 * * * * sudo -u www-data /usr/bin/php8.2 -f /var/www/nextcloud/occ preview:pre-generate -vv > /var/log/preview-generator.log

But that is not correct.
Cron jobs are basically executed as the user you define.

cronjobs can be scheduled either as a user-specific task using the user’s crontab or as a system-wide task in the /etc/crontab file.

  1. User-specific crontab:
  • Each user on a Linux system can have their own crontab, which contains scheduled tasks specific to that user.
  • To access and edit the user’s crontab, one can use the crontab -u "$user" -e command.
  • The entries in a user’s crontab do not need to specify the user because they are associated with the user account that owns the crontab.
  • The user specific crontabs are located in "/var/spool/cron/crontabs/*" and would look like this:
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
*/10 * * * *        /usr/bin/php8.2 -f /var/www/nextcloud/occ preview:pre-generate -vv > /var/log/preview-generator.log
  1. System-wide crontab (/etc/crontab):
  • The system-wide crontab is a central location for scheduling tasks that apply to the entire system.
  • Entries in the system-wide crontab need to specify the user under whose privileges the cronjob should run. This is done by including the user’s ID in the 6th position of the cronjob line.
  • For example, a line in /etc/crontab might look like this:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
*/10 * * * *    www-data /usr/bin/php8.2 -f /var/www/nextcloud/occ preview:pre-generate -vv > /var/log/preview-generator.log

Here, “www-data” is the user under whose privileges the cronjob will run.

Now, if you create a cronjob executed by root with sudo -u www-data, you are essentially trying to run the cronjob with the privileges of the “www-data” user. In this case, you should add the cronjob to the user-specific crontab for the “www-data” user, and the entry in the crontab file does not need to specify the user because it’s already associated with the “www-data” user.


ernolf

1 Like