# Permissions of Cache Directories

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpermissions-of-cache-directories%2F49990%3E%5C
**Category:** 🤗Hub\
**Created:** [August 8, 2023, 4:23pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpermissions-of-cache-directories%2F49990 "2023-08-08T16:23:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArsenieBoca](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@ArsenieBoca](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FArsenieBoca)%5C
**Post date:** [August 8, 2023, 4:23pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpermissions-of-cache-directories%2F49990%2F1 "2023-08-08T16:23:35Z")

</div>

Hi,

we are trying to use a shared cache directory between users. However, when loading a new model from the hub with `.from_pretrained` the permissions of the created directory is 700, i.e. others can’t read it.

Shouldn’t the permission be the same as the root cache directory?

How can I modify the permissions of cached models, preferrably per ENV variable?

---

<div class="post-metadata">

**Author:** ![bdellabe](https://avatars.discourse-cdn.com/v4/letter/b/848f3c/32.png) [@bdellabe](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbdellabe)%5C
**Post date:** [July 17, 2025, 4:17pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpermissions-of-cache-directories%2F49990%2F2 "2025-07-17T16:17:14Z")

</div>

+1 to this. We hit many issues using a shared cache directory, a couple cases:

- User1 creates folder when downloading model/dataset, which doesn’t have group write permissions. User2 cannot use it because they can’t add a `.lock` file to the folder.
- User3 attempts to remove User2’s `.lock` file, and fails on permission error.

Is there any way to resolve these, without some cron job that updates permissions and prunes `.lock` files as root?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [July 17, 2025, 10:59pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fpermissions-of-cache-directories%2F49990%2F3 "2025-07-17T22:59:15Z")

</div>

In some minor cases, the issue can be resolved simply by changing the `HF_HOME` environment variable (`HF_CACHE` or so also defaults to depend on this environment variable).

```auto
export HF_HOME="/somewhere_shared/huggingface" # instead of default "~/.cache/huggingface"

```

However, in this case, there is `.lock` and multiple users are involved, which makes it more complicated…  
You [may need to apply a patch to the `file_download` function](https://github.com/huggingface/huggingface_hub/issues/1141).
