From af6c57a05601540caa36638704b62f31b2481e07 Mon Sep 17 00:00:00 2001 From: sup3rlativ3 Date: Tue, 15 Oct 2019 22:30:25 +1100 Subject: [PATCH] added primer on permissions --- Docs/Cmdlets/Add-NTFSAccess.md | 49 ++++++++--------- Docs/Permissions.md | 98 ++++++++++++++++++++++++++++++++++ Docs/index.md | 6 ++- 3 files changed, 124 insertions(+), 29 deletions(-) create mode 100644 Docs/Permissions.md diff --git a/Docs/Cmdlets/Add-NTFSAccess.md b/Docs/Cmdlets/Add-NTFSAccess.md index fa67744..98cc4b8 100644 --- a/Docs/Cmdlets/Add-NTFSAccess.md +++ b/Docs/Cmdlets/Add-NTFSAccess.md @@ -14,31 +14,27 @@ Adds an access control entry (ACE) to an object. ## SYNTAX ### PathComplex (Default) - -```PowerShell +``` Add-NTFSAccess [-Path] [-Account] [-AccessRights] [-AccessType ] [-InheritanceFlags ] [-PropagationFlags ] [-PassThru] [] ``` ### PathSimple - -```PowerShell +``` Add-NTFSAccess [-Path] [-Account] [-AccessRights] [-AccessType ] [-AppliesTo ] [-PassThru] [] ``` ### SDSimple - -```PowerShell +``` Add-NTFSAccess [-SecurityDescriptor] [-Account] [-AccessRights] [-AccessType ] [-AppliesTo ] [-PassThru] [] ``` ### SDComplex - -```PowerShell +``` Add-NTFSAccess [-SecurityDescriptor] [-Account] [-AccessRights] [-AccessType ] [-InheritanceFlags ] [-PropagationFlags ] [-PassThru] [] @@ -46,25 +42,9 @@ Add-NTFSAccess [-SecurityDescriptor] [-Account] Add-NTFSAccess -Path C:\Data -Account 'NT AUTHORITY\Authenticated Users' -AccessRights Read -``` - -The above command gives the read permissions to the built-in group of 'Authenticated users' - -## PARAMETERS - -### -AccessRights - -The AccessRights parameter designates the permissions to assign. There are individual permissions as well as 'basic' permissions. See the below table for how the basic permissions permissions map the the advanced permissions in the advanced security window. - -| AccessRights Applied | AccessRight displayed | Advanced Security Window | +| NTFSSecurity | AccessRight displayed | Advanced Security Window | |------------------------------|------------------------------|---------------------------------------------------------------------------------------------------------------------------| | ReadData | ListDirectory | List Folder / Read Data | | ListDirectory | ListDirectory | List Folder / Read Data | @@ -87,6 +67,22 @@ The AccessRights parameter designates the permissions to assign. There are indiv | Modify | Modify | Everything except Full Control, Delete SubFolders and Files, Change Permissions, Take Ownership | | ChangePermissions | ChangePermissions | Change Permissions | +## EXAMPLES + +### Example 1 + +```PowerShell +PS C:\> Add-NTFSAccess -Path C:\Data -Account 'NT AUTHORITY\Authenticated Users' -AccessRights Read +``` + +The above command gives the read permissions to the built-in group of 'Authenticated users' + +## PARAMETERS + +### -AccessRights + +The AccessRights parameter designates the permissions to assign. There are individual permissions as well as 'basic' permissions. See the below table for how the basic permissions permissions map the the advanced permissions in the advanced security window. + ```yaml Type: FileSystemRights2 Parameter Sets: (All) @@ -233,7 +229,6 @@ Accept wildcard characters: False ``` ### CommonParameters - This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/Docs/Permissions.md b/Docs/Permissions.md new file mode 100644 index 0000000..62ba312 --- /dev/null +++ b/Docs/Permissions.md @@ -0,0 +1,98 @@ +# Permissions + +## Overview + +Before starting with the NTFSSecurity module there are some core concepts that you will need to understand. + +There are two ways you can handle permissions, basic and advanced. The basic set of permissions are goups of advanced permissions that allow you to assign common role such as 'Read', 'Read/Write', or 'Full'. Advanced permissions allow you granular control of what can and can't be access or used. The advanced permissions are commonly used to build custom Role-Based Access Control tooling. + +Below is an explaination taken from the fantastic site NTFS.com for each of the advanced file permissions. + +### Traverse Folder/Execute File + +* **Traverse Folder**: Allows or denies moving through a restricted folder to reach files and folders beneath the restricted folder in the folder hierarchy. Traverse folder takes effect only when the group or user is not granted the "Bypass traverse checking user" right in the Group Policy snap-in. This permission does not automatically allow running program files. + +* **Execute File**: Allows or denies running program (executable) files. + +### List Folder/Read Data + +* **List Folder**: Allows or denies viewing file names and subfolder names within the folder. List Folder only affects the contents of that folder and does not affect whether the folder you are setting the permission on will be listed. + +* **Read Data**: Allows or denies viewing data in files. + +### Read Attributes + +* Allows or denies viewing the attributes of a file or folder, for example, "read-only" and "hidden". + +### Read Extended Attributes + +* Allows or denies viewing the extended attributes of a file or folder. Extended attributes are defined by programs and may vary by program. + +### Create Files/Write Data + +* **Create Files**: Allows or denies creating files within the folder. + +* **Write Data**: Allows or denies making changes to a file and overwriting existing content. + +### Create Folders/Append Data + +* **Create Folders**: Allows or denies creating subfolders within the folder. + +* **Append Data**: Allows or denies making changes to the end of the file but not changing, deleting, or overwriting existing data. + +### Write Attributes + +* Allows or denies changing the attributes of a file or folder, for example, "read-only" or "hidden". + +* The Write Attributes permission does not imply creating or deleting files or folders, it only includes the permission to make changes to the attributes of an existing file or folder. + +### Write Extended Attributes + +* Allows or denies changing the extended attributes of a file or folder. Extended attributes are defined by programs and may vary by program. + +* The Write Extended Attributes permission does not imply creating or deleting files or folders, it only includes the permission to make changes to the extended attributes of an existing file or folder. + +### Delete Subfolders and Files + +* Allows or denies deleting subfolders and files, even if the Delete permission has not been granted on the subfolder or file. + +### Delete + +* Allows or denies deleting the file or folder. If you don't have Delete permission on a file or folder, you can still delete it if you have been granted Delete Subfolders and Files on the parent folder. + +### Read Permissions + +* Allows or denies reading permissions of a file or folder. + +### Change Permissions + +* Allows or denies changing permissions of the file or folder. + +### Take Ownership + +* Allows or denies taking ownership of the file or folder. The owner of a file or folder can always change permissions on it, regardless of any existing permissions that protect the file or folder. + +You can see how the basic permissions, advanced permissions, and the NTFSSecurity module relate to one another in the below table. + +| NTFSSecurity | AccessRight displayed | Advanced Security Window | +|------------------------------|------------------------------|---------------------------------------------------------------------------------------------------------------------------| +| ReadData | ListDirectory | List Folder / Read Data | +| ListDirectory | ListDirectory | List Folder / Read Data | +| WriteData | CreateFile | Create Files / Write Data | +| CreateFiles | CreateFile | Create Files / Write Data | +| AppendData | CreateDirectories | Create Folders / Append Data | +| CreateDirectories | CreateDirectories | Create Folders / Append Data | +| ReadExtendedAttributes | ReadExtendedAttributes | Read Extended Attributes | +| WriteExtendedAttributes | WriteExtendedAttributes | WriteExtendedAttributes | +| ExecuteFile | Traverse | Traverse Folder / Execute File | +| Traverse | Traverse | Traverse Folder / Execute File | +| DeleteSubdirectoriesAndFiles | DeleteSubdirectoriesAndFiles | Delete Sub-folders and Files | +| ReadAttributes | ReadAttributes | Read Attributes | +| WriteAttributes | WriteAttributes | Write Attributes | +| Write | Write | Create Files / Write Data, Create Folders / Append Data, Write-Attributes, Write Extended Attributes | +| Delete | Delete | Delete | +| ReadPermissions | ReadPermissions | Read Permissions | +| Read | Read | List Folder / Read Data, Read Attributes, Read Extended Attributes, Read Permissions | +| ReadAndExecute | ReadAndExecute | Traverse Folder / Execute File, List Folder / Read Data, Read Attributes, Read Extended Attributes, Read Permissions | +| Modify | Modify | Everything except Full Control, Delete SubFolders and Files, Change Permissions, Take Ownership | +| ChangePermissions | ChangePermissions | Change Permissions | diff --git a/Docs/index.md b/Docs/index.md index da66399..a8924b9 100644 --- a/Docs/index.md +++ b/Docs/index.md @@ -21,9 +21,11 @@ Further help can be found in How to install if you face difficulties getting thi ## Documentation -The cmdlets are yet not documented completely so Get-Help will not show help for all the cmdlets. Providing documentation is planned though. +The cmdlets are yet not documented completely so Get-Help will not show help for all the cmdlets. This ReadTheDocs site is the first step to documenting the module. -## Additional documentation is available +## Tutorials + +There are a number of tutorials available on the web. The below two were written by the author of the NTFSSecurity module. [NTFSSecurity Tutorial 1 - Getting, adding and removing permissions](http://blogs.technet.com/b/fieldcoding/archive/2014/12/05/ntfssecurity-tutorial-1-getting-adding-and-removing-permissions.aspx) [NTFSSecurity Tutorial 2 - Managing NTFS Inheritance and Using Privileges](http://blogs.technet.com/b/fieldcoding/archive/2014/12/05/ntfssecurity-tutorial-2-managing-ntfs-inheritance-and-using-privileges.aspx)