# Automated Tasks Error - Failed to open stream: Permission denied

**URL:** https://forums.concretecms.org/t/automated-tasks-error-failed-to-open-stream-permission-denied/3401
**Category:** Using Concrete / Help
**Created:** [June 28, 2022, 8:06am UTC](https://forums.concretecms.org/t/automated-tasks-error-failed-to-open-stream-permission-denied/3401 "2022-06-28T08:06:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![pav03](https://forums.concretecms.org/user_avatar/forums.concretecms.org/pav03/32/1176_2.png) [@pav03](https://forums.concretecms.org/u/pav03)
#### Post date: [June 28, 2022, 8:06am UTC](https://forums.concretecms.org/t/automated-tasks-error-failed-to-open-stream-permission-denied/3401/1 "2022-06-28T08:06:16Z")

</div>

Hello community!

**Concrete Version:** 9.1.0  
**PHP Version:** 7.4.30

I followed the instructions in the official documentation to set up an automated task for sitemap generation.

First part of the process was setting up the cron:

```auto
* * * * * /path/to/public/concrete/bin/concrete concrete:scheduler:run >> /dev/null 2>&1

```

I then added the following expression:

```auto
0 0 * * *

```

Now, when I try to access tasks via the dashboard, I am getting the following error:

```auto
/application/files/cache/expensive/0fea6a13c52b4d47/25368f24b045ca84/38a865804f8fdcb6/57cd99682e939275/2ddb27c5cdf0b672/745d4c64665be841/dc4f6a3c82dec34b/a7e4acc6325bbadb.php): failed to open stream: Permission denied

```

It seems to be related to line 46 of /concrete/src/Cache/Driver/FileSystemStashDriver.php

```auto
$result = file_put_contents($path, $storeString, LOCK_EX);

```

I’m no developer, but I would be inclined to guess this was some kind of permissions issue.

However, I’m not really sure how to fix this.

Any advice is appreciated!

---

<div class="post-metadata">

### Author: ![pav03](https://forums.concretecms.org/user_avatar/forums.concretecms.org/pav03/32/1176_2.png) [@pav03](https://forums.concretecms.org/u/pav03)
#### Post date: [June 28, 2022, 12:50pm UTC](https://forums.concretecms.org/t/automated-tasks-error-failed-to-open-stream-permission-denied/3401/2 "2022-06-28T12:50:21Z")

</div>

I have resolved this issue. I will post the solution, as it may help others.

The fix was to change ownership of where the old root cron had written files.

---

<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:21pm UTC](https://forums.concretecms.org/t/automated-tasks-error-failed-to-open-stream-permission-denied/3401/3 "2024-06-26T14:21:22Z")

</div>

> [@pav03](#):
>
> The fix was to change ownership of where the old root cron had written files.

Hello - I am having this exact same issue - could you post your fix if possible please?

Thanks!

---

<div class="post-metadata">

### Author: ![mlocati](https://forums.concretecms.org/user_avatar/forums.concretecms.org/mlocati/32/6208_2.png) [@mlocati](https://forums.concretecms.org/u/mlocati)
#### Post date: [June 26, 2024, 8:40pm UTC](https://forums.concretecms.org/t/automated-tasks-error-failed-to-open-stream-permission-denied/3401/4 "2024-06-26T20:40:44Z")

</div>

The solution is to run `/path/to/public/concrete/bin/concrete` with the same user as the webserver.

If the user impersonated by the webserver is `www-data`, you can simply use

```auto
sudo -u www-data /path/to/public/concrete/bin/concrete

```

instead of

```auto
/path/to/public/concrete/bin/concrete

```

---

<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 1, 2024, 11:25am UTC](https://forums.concretecms.org/t/automated-tasks-error-failed-to-open-stream-permission-denied/3401/5 "2024-07-01T11:25:29Z")

</div>

Thank you @ [mlocati](https://forums.concretecms.org/u/mlocati)

Annoyingly, that does not work for me, the scheduler does not run. I expect it is going to be a syntax error on my part, but I am just not able to work it out.

I have since started another post about the issue I am experiencing here:

> [@'Reindex Content' Task Error - Failed to open stream: Permission denied](https://forums.concretecms.org/t/reindex-content-task-error-failed-to-open-stream-permission-denied/7697):
>
> 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: \* \* \* \* \* /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…
