# Windows - Matrice des permissions NTFS

### <span style="text-decoration:underline;color:rgb(52,73,94);">**I. Introduction**</span>

Lors de la création des acl avec powershell, il faut utiliser un formatage spécifique.

```powershell
$acl.AddAccessRule([System.Security.AccessControl.FileSystemAccessRule]::new(
  "<groupeAD>", "ReadAndExecute","ContainerInherit,ObjectInherit","none","Allow"
  ))
```

Le document ci-dessous décrit les éléments attendus pour chaque attribut.

---

### <span style="text-decoration:underline;color:rgb(52,73,94);">**II. Valeurs attendues**</span>

#### <span style="color:rgb(35,111,161);">**2.1 Attribut 1 : Nom de groupe**</span>

Le premier attribut est le nom du groupe / utilisateur sur lequel les permissions vont s'appliquer. Celui-ci est au format '<span style="color:rgb(132,63,161);">***Scope\\Groupe***</span>'

<table class="align-center" id="bkmrk-groupe-%2F-utilisateur" style="border-collapse:collapse;width:21.5476%;height:506.547px;"><colgroup><col style="width:21.5733%;"></col></colgroup><tbody><tr><td class="align-center" style="background-color:rgb(194,224,244);">**Groupe / Utilisateur**  
</td></tr><tr style="height:29.7969px;"><td style="height:29.7969px;">Domaine\\groupe</td></tr><tr style="height:29.7969px;"><td style="height:29.7969px;">Builtin\\groupe</td></tr><tr style="height:29.7969px;"><td style="height:29.7969px;">groupe local</td></tr><tr style="height:29.7969px;"><td style="height:29.7969px;">everyone</td></tr><tr style="height:29.7969px;"><td style="height:29.7969px;">"NT AUTHORITY\\SYSTEM"</td></tr></tbody></table>

#### <span style="color:rgb(35,111,161);">**2.2 Attribut 2 : Droits à appliquer**</span>

Le Second attribut contiennent le(s) droit(s) à appliquer. Il est possible d'en mettre plusieurs, en les séparant par une virgule.

*exemple : "Read,Write,ReadAndExecute"*

Ils sont de trois types :

- **Normaux**

- - `Read`
    - `Write`
    - `ReadAndExecute`
    - `Modify`
    - `FullControl`
    - `ListDirectory`
    - `ReadAttributes`
    - `ReadExtendedAttributes`
    - `WriteAttributes`
    - `WriteExtendedAttributes`
    - `Delete`
    - `DeleteSubdirectoriesAndFiles`
    - `ReadPermissions`
    - `ChangePermissions`
    - `TakeOwnership`
    - `Synchronize`

- **Combinés**

- - `ReadData`
    - `WriteData`
    - `AppendData`
    - `ExecuteFile`

- **Spéciaux**

- - `Traverse`
    - `CreateFiles`
    - `CreateDirectories`

#### <span style="color:rgb(35,111,161);">**2.3 Attribut 3 : Héritage**</span>

Le troisième attribut concerne la portée des droits.

<table id="bkmrk-valeur-signification" style="border-collapse:collapse;width:100%;"><colgroup><col style="width:50%;"></col><col style="width:50%;"></col></colgroup><tbody><tr><td class="align-center" style="background-color:rgb(194,224,244);">**Valeur**</td><td class="align-center" style="background-color:rgb(194,224,244);">**Signification**  
</td></tr><tr><td>None</td><td>S'applique uniquement à ce dossier</td></tr><tr><td>ContainerInherit</td><td>S'applique aux sous-dossiers</td></tr><tr><td>ObjectInherit</td><td>S'applique aux fichiers</td></tr><tr><td>ContainerInherit,ObjectInherit</td><td>S'applique aux sous-dossiers et aux fichiers</td></tr></tbody></table>

#### <span style="color:rgb(35,111,161);">**2.4 Attribut 4 : Propagation**</span>

Le quatrième attribut désigne la propagations des permissions.

<table id="bkmrk-valeur-signification-1" style="border-collapse:collapse;width:100%;"><colgroup><col style="width:50%;"></col><col style="width:50%;"></col></colgroup><tbody><tr><td class="align-center" style="background-color:rgb(194,224,244);">**Valeur**</td><td class="align-center" style="background-color:rgb(194,224,244);">**Signification**  
</td></tr><tr><td>None</td><td>Héritage normal récursif.</td></tr><tr><td>NoPropagateInherit</td><td>S'applique aux enfants direct mais pas en dessous.</td></tr><tr><td>InheritOnly</td><td>S'applique uniquement aux enfants mais pas aux parents.</td></tr></tbody></table>

#### <span style="color:rgb(35,111,161);">**2.5 Attribut 5 : Type**</span>

Le dernier paramètre définit le type d'ACL. Deux types :

- Allow
- Deny

<p class="callout info">**Info** : Pour rappel, les ACL de type 'Deny' sont prioritaire par rapport à un 'Allow'.</p>