# 'Reindex Content' Task Error - Failed to open stream: Permission denied

**URL:** https://forums.concretecms.org/t/reindex-content-task-error-failed-to-open-stream-permission-denied/7697
**Category:** Using Concrete / Help
**Created:** [June 26, 2024, 2:28pm UTC](https://forums.concretecms.org/t/reindex-content-task-error-failed-to-open-stream-permission-denied/7697 "2024-06-26T14:28:44Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![drbiskit](https://forums.concretecms.org/user_avatar/forums.concretecms.org/drbiskit/32/4493_2.png) [@drbiskit](https://forums.concretecms.org/u/drbiskit)
#### Post date: [June 26, 2024, 2:28pm UTC](https://forums.concretecms.org/t/reindex-content-task-error-failed-to-open-stream-permission-denied/7697/1 "2024-06-26T14:28:44Z")

</div>

Hi,

I am having an issue with the automated running of the ‘Reindex Content’ task…

- The server is nginx on Ubuntu 22.04.3
- Concrete v 9.3.2
- PHP 8.2

I have set up the task scheduler, and that is running fine every minute - It runs other jobs fine - eg. Create Sitemap, Clear cache, etc.

This is the scheduler cron:

```auto
* * * * * /usr/bin/php8.2 -q /path/to/concrete/bin/concrete concrete:scheduler:run >> /dev/null 2>&1
```

With the ‘Reindex Content’ task it creates the cache directories/files with ‘root’ ownership/permissions, but it needs to be set as ‘www-data’.

So we get exceptions e.g.:

```auto
Exception Occurred: /path/to/concrete/src/Cache/Driver/FileSystemStashDriver.php:40 touch(): Unable to create file /path/to/application/files/cache/overrides/1952a01898073d1e/561b9b4f2e42cbd7/38a865804f8fdcb6/57cd99682e939275/e56c038d63394797/2de43d2a2b4d5ff5.php because Permission denied (2)
```

I have tried:

====

1 - Adding the www-data user to the scheduler - eg:

```auto
* * * * * sudo -u www-data /usr/bin/php8.2 -q /path/to/concrete/bin/concrete concrete:scheduler:run >> /dev/null 2>&1
```

Amongst a whole bunch of other variations on this - none of them run at all, only the example given above seems to run.

====

2 - Setting up the scheduler cron for www-data - using:

```auto
sudo crontab -u www-data -e
```

But the scheduler does not run then either.

====

I have set this up several other times on Apache servers with no problems, and so I expect this is simply a syntax issue, but I am not having any joy after much trying - any suggestions would be great.

Thanks all.

---

<div class="post-metadata">

### Author: ![Myq](https://forums.concretecms.org/user_avatar/forums.concretecms.org/myq/32/4281_2.png) [@Myq](https://forums.concretecms.org/u/Myq)
#### Post date: [July 1, 2024, 5:42pm UTC](https://forums.concretecms.org/t/reindex-content-task-error-failed-to-open-stream-permission-denied/7697/2 "2024-07-01T17:42:00Z")

</div>

Does sound like a permissions issue. is the user where the files live part of the www-data group?

---

<div class="post-metadata">

### Author: ![drbiskit](https://forums.concretecms.org/user_avatar/forums.concretecms.org/drbiskit/32/4493_2.png) [@drbiskit](https://forums.concretecms.org/u/drbiskit)
#### Post date: [July 3, 2024, 1:40pm UTC](https://forums.concretecms.org/t/reindex-content-task-error-failed-to-open-stream-permission-denied/7697/3 "2024-07-03T13:40:24Z")

</div>

Thanks for response [Myq](https://forums.concretecms.org/u/Myq)

Yes, can confirm it is.

---

<div class="post-metadata">

### Author: ![EvanCooper](https://forums.concretecms.org/user_avatar/forums.concretecms.org/evancooper/32/4597_2.png) [@EvanCooper](https://forums.concretecms.org/u/EvanCooper)
#### Post date: [July 12, 2024, 2:48am UTC](https://forums.concretecms.org/t/reindex-content-task-error-failed-to-open-stream-permission-denied/7697/4 "2024-07-12T02:48:12Z")

</div>

Yeah still seems like a permissions issue - are the perms on the files directory 755? I think some of that is covered in this doc here:

> **[Configuration Best Practices](https://documentation.concretecms.org/developers/introduction/configuration-best-practices)**

But yeah definitely seems like it’s still server-permissions-related.

---

<div class="post-metadata">

### Author: ![drbiskit](https://forums.concretecms.org/user_avatar/forums.concretecms.org/drbiskit/32/4493_2.png) [@drbiskit](https://forums.concretecms.org/u/drbiskit)
#### Post date: [July 12, 2024, 10:53am UTC](https://forums.concretecms.org/t/reindex-content-task-error-failed-to-open-stream-permission-denied/7697/5 "2024-07-12T10:53:14Z")

</div>

Thanks @EvanCooper - Yes, can confirm that the permissions are set to 755.

---

<div class="post-metadata">

### Author: ![Myq](https://forums.concretecms.org/user_avatar/forums.concretecms.org/myq/32/4281_2.png) [@Myq](https://forums.concretecms.org/u/Myq)
#### Post date: [August 8, 2024, 9:09pm UTC](https://forums.concretecms.org/t/reindex-content-task-error-failed-to-open-stream-permission-denied/7697/6 "2024-08-08T21:09:40Z")

</div>

maybe the problem is in the cache directory rather than the cron. ensure that all dirs in cache are owned by the correct user with `chown -R www-data:www-data cache` (or whatever `user:group` is appropriate). It’s possible one of those parent dirs is owned by root or something.

---

<div class="post-metadata">

### Author: ![drbiskit](https://forums.concretecms.org/user_avatar/forums.concretecms.org/drbiskit/32/4493_2.png) [@drbiskit](https://forums.concretecms.org/u/drbiskit)
#### Post date: [August 14, 2024, 4:37pm UTC](https://forums.concretecms.org/t/reindex-content-task-error-failed-to-open-stream-permission-denied/7697/7 "2024-08-14T16:37:32Z")

</div>

Thanks for response [Myq](https://forums.concretecms.org/u/Myq).

Yes, all the parent/child directories are correctly set to www-data:www-data. They only change to root: root when the automated ‘Reindex Content’ task runs.

If I run the ‘Reindex Content’ task manually, the permissions stay correct as www-data:www-data.

Very odd/annoying!
