Forum Discussion
JohnnyHuang
Jun 04, 2021Copper Contributor
How to Share sub Folders with Specific Users in Windows
Current i got some specific user need to access many of sub folder, any idea or easy way to perform ?
- Andy MeboldtCopper Contributor
What is your goal?
Do you want to know how to share the root-folder or how to share all subfolders?
To create a share for each subfolder, you can use the following Powershell:$Roofolder = "D:\Folder" $User = "domain\username" $Subfolders = Get-ChildItem -Path $Roofolder foreach($Subfolder in $Subfolders){New-SmbShare -Name $Subfolder.Name -Path $Subfolder.fullname -FullAccess $User}
- Chad_MickelberryCopper Contributor
These instructions are the "End All" and correct process for doing this.
Pre-Req: Enable access-based enumeration.
1. Server Manager > File and Storage Services > Shares
2. On particular Share, right click > properties > settings > Check - Enable access-based enumeration
Secondly: Create Active Directory Group
1. Navigate to your Users folder. Below folder, create or use existing Groups OU.
2. Create new Group and name it accordingly (e.g Folder Permission - Sub_Folder1)
3. Add User to the new Group
Assign permission to Sub_Folder1 exclusively.
1. Navigate in server's explorer to Sub_Folder1 (e.g. Sharing_Folder > Sub_Folder1)
2. Right Click > Properties
3. Security > Advanced > Disable Inheritance > Convert
4. Add new Group with whatever permissions you need. Check "Replace all child..."
5. Close out of properties.
Now properly share it so Enumeration occurs dynamically.
1. Right click Sub_Folder1
2. Share with ... > Specific People
3. Choose new Group.
4. Make sure permissions for that group is correct... Either Read, or Read/Write.
5. Then Share.
Confirm
1. Now have user log out of windows and back in.
2. New path should be accessible, and only that specific path to Sub_Folder1 should be seen.
3. Full control will be allowed in Sub_Folder1 if those were the permissions you gave.