# Stuck @ CHOWN for /var/www/discourse

**URL:** <https://meta.discourse.org/t/stuck-chown-for-var-www-discourse/74138>\
**Category:** Self-hosting\
**Created:** [2017 年 11 月 15 日午後 11:16 UTC](https://meta.discourse.org/t/stuck-chown-for-var-www-discourse/74138 "2017-11-15T23:16:48Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![Cameron\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cameron_d/32/97535_2.png) [@Cameron\_D](https://meta.discourse.org/u/Cameron_D)\
**Post date:** [2018 年 5 月 3 日午前 10:23 UTC](https://meta.discourse.org/t/stuck-chown-for-var-www-discourse/74138/13 "2018-05-03T10:23:55Z")

</div>

Hi, bit of a bump, but I have had the same problem since I first tried Discourse.

From my understanding, `chown` will set the ownership of all files, irregardless of the current owner. Of course after the first setup the files should already be owned by the `discourse` user, so there is no need to change them _all_, just the new ones.

On my install I’ve changed the `web.template.yml` to use `find` to change only files that aren’t already owned by `discourse`. That part of a rebuild used to take 8+ minutes (VM on ZFS with no SSD) and now its almost instant.

There are a couple of instances of `chown` in the template, but I think the “main” one is this one:

> <https://github.com/discourse/discourse_docker/blob/master/templates/web.template.yml#L165>

Which I’ve replaced with:

```bash
find $home ! -user discourse -exec chown discourse {} \+

```

Which finds all files not owned by `discourse` and executes `chown` on them.

---

_[View the full topic](https://meta.discourse.org/t/stuck-chown-for-var-www-discourse/74138)._
