# Cannot execute preview generation

**URL:** <https://help.nextcloud.com/t/cannot-execute-preview-generation/74716>\
**Category:** ℹ️ Support\
**Tags:** preview, nc18-nextcloud-hub\
**Created:** [March 21, 2020, 9:15pm UTC](https://help.nextcloud.com/t/cannot-execute-preview-generation/74716 "2020-03-21T21:15:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cloo](https://help.nextcloud.com/user_avatar/help.nextcloud.com/cloo/32/16751_2.png) [@cloo](https://help.nextcloud.com/u/cloo)\
**Post date:** [March 21, 2020, 9:15pm UTC](https://help.nextcloud.com/t/cannot-execute-preview-generation/74716/1 "2020-03-21T21:15:12Z")

</div>

When I try to run  
`sudo php /var/www/html/occ preview:pre-generate`

I get the response:

```auto
Console has to be executed with the user that owns the file config/config.php
Current user: root
Owner of config.php: www-data

```

But it is not allowed to execute things as www-data by doing sudo su - www-data because of security reasons.

Am I doing something completely wrong?

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 11, 2024, 9:15pm UTC](https://help.nextcloud.com/t/cannot-execute-preview-generation/74716/2 "2024-12-11T21:15:28Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 11, 2024, 9:15pm UTC](https://help.nextcloud.com/t/cannot-execute-preview-generation/74716/3 "2024-12-11T21:15:29Z")

</div>


