# Wieso legt Shopware var/cache/\*/templates/ und Directories in media/ mit umask 022 statt 002 an?

**URL:** https://forum.shopware.com/t/wieso-legt-shopware-var-cache-templates-und-directories-in-media-mit-umask-022-statt-002-an/59901
**Category:** Administration
**Created:** [6. Juni 2019 um 13:28 UTC](https://forum.shopware.com/t/wieso-legt-shopware-var-cache-templates-und-directories-in-media-mit-umask-022-statt-002-an/59901 "2019-06-06T13:28:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![oikleaf](https://avatars.discourse-cdn.com/v4/letter/o/8e8cbc/32.png) [@oikleaf](https://forum.shopware.com/u/oikleaf)
#### Post date: [6. Juni 2019 um 13:28 UTC](https://forum.shopware.com/t/wieso-legt-shopware-var-cache-templates-und-directories-in-media-mit-umask-022-statt-002-an/59901/1 "2019-06-06T13:28:44Z")

</div>

Hallo,

auf meinem Server habe ich dem Verzeichnis&nbsp;var/cache/development… und allen Unterverzeichnissen von media mit setfacl&nbsp;folgende Access Control List (ACL) zugewiesen, damit ich Verzeichnisse und Dateien, die von Shopware erzeugt werden, mit meinem&nbsp;Linux-User namens admin löschen kann.

```
# owner: admin
# group: admin
user::rwx
user:www-data:rwx
group::rwx
mask::rwx
other::---
default:user::rwx
default:user:admin:rwx
default:group::rwx
default:mask::rwx
default:other::---

```

Im&nbsp;var/cache/development…&nbsp;erzeugt Shopware&nbsp;dann&nbsp;Unterverzeichnisse mit folgenden FileSystem-Permissions:

```
drwxrwx---+ 4 www-data www-data 39 Jun 6 13:01 doctrine
drwxrwx---+ 2 www-data www-data 6 Jun 6 13:01 general
drwxrwx---+ 2 www-data www-data 6 Jun 6 13:01 html
drwxrwx---+ 3 www-data www-data 24 Jun 6 13:01 mpdf
drwxrwx---+ 2 www-data www-data 4096 Jun 6 13:02 proxies
drwxr-x---+ 4 www-data www-data 73 Jun 6 13:02 templates

```

Wieso&nbsp;unterscheiden sich die Dateisystem-Rechte&nbsp;des Ordners templates? Entsprechend kann ich in templates enthaltene Verzeichnisse und Dateien&nbsp;eben nicht mit meinem Linux-User löschen. Betroffen sind auch alle&nbsp;Ordner, die Shopware irgendwo unterhalb von var/cache/\*/general/ und media/ anlegt.

Ich bedanke mich für jegliches Feedback!

---

<div class="post-metadata">

### Author: ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)
#### Post date: [6. Juni 2019 um 13:34 UTC](https://forum.shopware.com/t/wieso-legt-shopware-var-cache-templates-und-directories-in-media-mit-umask-022-statt-002-an/59901/2 "2019-06-06T13:34:24Z")

</div>

Eigentlich abhängig von der Umask:&nbsp;

> <https://github.com/shopware/shopware/blob/5.5/engine/Shopware/Configs/Default.php#L285>

> **[File permissions and umask in PHP and Shopware](https://developers.shopware.com/blog/2016/02/26/file-permissions-and-umask-in-php-and-shopware/#search-results)**
>
> Preposition
> 
> This post requires basic understanding of Unix File system permissions.
> 
> Permissions of new files and directories
> 
> Have you ever wondered how

Im Regelfall reicht auch 755 bei korrekter User- und Gruppendefinition.&nbsp;

---

<div class="post-metadata">

### Author: ![oikleaf](https://avatars.discourse-cdn.com/v4/letter/o/8e8cbc/32.png) [@oikleaf](https://forum.shopware.com/u/oikleaf)
#### Post date: [6. Juni 2019 um 13:40 UTC](https://forum.shopware.com/t/wieso-legt-shopware-var-cache-templates-und-directories-in-media-mit-umask-022-statt-002-an/59901/3 "2019-06-06T13:40:40Z")

</div>

Umask habe ich nirgends explizit konfiguriert. Müssten dann nicht die anderen Verzeichnisse dieselben Rechte haben?

---

<div class="post-metadata">

### Author: ![oikleaf](https://avatars.discourse-cdn.com/v4/letter/o/8e8cbc/32.png) [@oikleaf](https://forum.shopware.com/u/oikleaf)
#### Post date: [6. Juni 2019 um 18:08 UTC](https://forum.shopware.com/t/wieso-legt-shopware-var-cache-templates-und-directories-in-media-mit-umask-022-statt-002-an/59901/4 "2019-06-06T18:08:36Z")

</div>

Nun habe ich in der Datei config.php folgende erste Zeile und damit funktioniert alles wie gewünscht.

?php umask(0002);

drwxrwx—+ 4 www-data www-data 4096 Jun&nbsp; 6&nbsp;13:49 doctrine  
drwxrwx—+ 5 www-data www-data 4096 Jun&nbsp; 6&nbsp;13:49 general  
drwxrwx—+ 2 www-data www-data 4096 Jun&nbsp; 6&nbsp;13:49 html  
drwxrwx—+ 3 www-data www-data 4096 Jun&nbsp; 6&nbsp;13:49 mpdf  
drwxrwx—+ 2 www-data www-data 4096 Jun&nbsp; 6&nbsp;13:49 proxies  
drwxrwx—+ 3 www-data www-data 4096 Jun&nbsp; 6&nbsp;13:49 templates

Mit umask(0000) oder umask(0007) funktioniert ebenfalls alles wie gewünscht.

Mit umask(0077); testweise bekomme ich diese Verzeichnisrechte:

drwxrwx—+ 4 www-data www-data 4096 Jun&nbsp; 6&nbsp;13:49&nbsp;doctrine  
drwxrwx—+ 5 www-data www-data 4096 Jun&nbsp; 6&nbsp;13:49&nbsp;general  
drwxrwx—+ 2 www-data www-data 4096 Jun&nbsp; 6&nbsp;13:49&nbsp;html  
drwxrwx—+ 3 www-data www-data 4096 Jun&nbsp; 6&nbsp;13:49&nbsp;mpdf  
drwxrwx—+ 2 www-data www-data 4096 Jun&nbsp; 6&nbsp;13:49&nbsp;proxies  
drwx------+ 3 www-data www-data 4096 Jun&nbsp; 6&nbsp;13:49 templates

Das Setting wirkt sich also offensichtlich nur auf den Ordner templates sowie alle Ordner in var/cache/\*/general und media aus.
