Archive

Archive for January, 2012

Set NTFS folder permissions using GPO

January 13, 2012 1 comment

Okay… so… todays posts isn’t something big and all rewamping of how you should do your daily tasks however it’s a small piece of advice on how to get business running again should you encounter a specific situation.

Imagine the following case; You and your collegaues around different departments have been hard at work making the entire setup for your new customer.
Servers has been in-sourced, client computers has been changed to meet new standards and a new Windows 7 image has been created with some of their business critical applications directly integrated while SCCM is configured to take care of the rest of the deployment once the right users logs in for the first time.
Your colleagues in the Remote Desktop Services department has even setup 50 new RDS servers in a special Home Workspace setup. Everything is tested and has been found to work beautifully.

Monday comes and the customer starts working on the new system but just as they fire up one of their business critical applications it crashes – for all of the users.

You discover that this is all due to incorrect NTFS permissions on the applications folder. The application is, sadly, installed directly in the image for all the client computers and even on the RDS servers.

Of course the image and the RDS servers setup needs to be corrected and repacked but this won’t solve the current incident for all teh users right now.

You could of course create a script and / or use cacls.exe to set the right permissions on the folder BUT let me show another neat trick you can do with Group Policy Objects directly through GUI.

Here’s a Step By Step guide to how you can do this.

1. Go to Start >“Search Programs and files”.

2. Type GPMC.msc and hit enter.

Please see Figure 1 for an image corresponding to the above steps.

NTFS folder permissions 1

Figure 1: Open GPMC

3. Go to the Group Policy Objects folder.

4. Right click and select “New”.

Please see Figure 2 for an image corresponding to the above steps.

NTFS folder permissions 2

Figure 2: Create a new GPO

5. Give the new GPO a good name so it’s easy to identify later on.

6. Click “OK”.

Please see Figure 3 for an image corresponding to the above steps.

NTFS folder permissions 3

Figure 3: Give the GPO a *good* name (Do not use the one in the example)

7. Edit the GPO and browse to the following location within:
Computer Configuration > Policies > Windows Settings > Security Settings > File System.

8. Right click at “File System” and click “Add File…”.

Please see Figure 4 for an image corresponding to the above steps.

NTFS folder permissions 4

Figure 4: Go to the File System part and select New

9. Select the application folder at the correct file system position.
If the application folder doesn’t exist at the computer you’re using simply create the folder at the correct place and select that.

10. Click the “OK” button.

Please see Figure 5 for an image corresponding to the above steps.

NTFSfolderpermissions5

Figure 5: Select or create the needed folder

11. You’ll now be presented with a Security window for the selected folder.
You should verify the permissions shown in the window before you proceed to the next step.

12. In our example we’ll add the “Domain Users” group to the security permissions. Do this by selecting the “Add” button.

Please see Figure 6 for an image corresponding to the above steps.

NTFS folder permissions 6

Figure 6: The Security window will appear

13. Type “Domain Users” into the “Enter the object names to select” field.

14. Select the “OK” button.

15. Select “Domain Users” and set the needed permissions. Here we have added Allow::Modify.
Your setup might need a whole lot of other permissions – this is only shown as an example and you should verify that all the permissions is setup as needed in your environment.

16. When done simply selct the “OK” button.

Please see Figure 7 for an image corresponding to the above steps.

NTFS folder permissions 7

Figure 7: Edit the security permissions

17. The “Add Object” window will now appear where you’ll have to make the final decision on how the permissions should be set upon the subfolders and files in regards to inheritable permissions on the files and folders.

18. When done simply selct the “OK” button.

Please see Figure 8 for an image corresponding to the above steps.

NTFS folder permissions 8

Figure 8: Select the appropriate settings

19. Once you’re through you’ll be presented with a view more or less identical to Figure 9.
All you need now is to link the GPO to the correct OU in the Group Policy Management Console and if you’re not using the User part of the GPO, it should be disabled just to keep things as they should be.

NTFS folder permissions 9

Figure 9: Done! You're Now a Hero!

I hope you enjoyed this little guide on how to save the day. I look forward to read your comments 🙂

Categories: Group Policy

“Recover” GPO Rights

January 6, 2012 2 comments

Have you ever experienced that a junior administrator or someone else by accident set a Deny “Read” permission for ie. “Authenticated Users” on a Group Policy Object when they actually wanted Deny “Apply GPO”? If you’re experiencing this problem or something similar, this post is certainly for you.

I’d like to show you 2 methods to discover the GUID for the Group Policy Object which is needed to “recover” the rights, which I’ll show you in the last part of this post.

Anyway… go grab a cup of coffee and let’s get started! 🙂

Part 1 – Find GUID – Easy Way

If the GPO link isn’t deleted in the Group Policy Management Console, you can easily find the GUID using these simple steps.

1. Go to Start > Run.
In Server 2008 simply use “Search Programs and files” in the Start menu instead.

2. Type GPMC.msc and hit enter.

3. Browse to the location where the object is LINKED to.
You won’t be able to find it in the Group Policy Objects container since you no longer have access to “read” it.

Recover GPO 1

Figure1: Open GPMC and browse to the linked location of the object.

4. Select the GPO object named “Inaccessible”.

Recover GPO 2

Figure 2: Select "Inaccessible".

5. Copy the GUID which appears under the scope tab in the content view of the Group Policy console.

Recover GPO 3

Figure 3: Copy the GUID (Unique ID) from the content view.

That’s it. If you could find the GUID using this way you can now jump to the 3rd part of this guide.

Part 2 – Find GUID – Advanced

If the link is deleted within the GPMC console you’ll have to use another approach to find the GUID.
My best offer is to use adsiedit.msc, which requires the Windows Support Tools to be installed on a Windows 2003 Server however this tool is available by default on a Windows 2008 Server.

In the next few steps I’ll show you how to use adsiedit.msc to discover the GUID of the Group Policy Object.

1. Go to Start > Run.

2. Type adsiedit.msc and hit enter.
In Server 2008 simply use “Search Programs and files” in the Start menu instead.

Recover GPO 4

Figure 4: Go to Run and type adsiedit.msc

3. Expand the DC container.

4. Expand the System container.

5. Expand the Policies container.

Recover GPO 5

Figure 5: Expand the Containers

6. Scroll through the list of group policy objects using the content view part of adsiedit.msc and locate the GUID which is represented by a notepad like document.
Notice that other GUIDs are looking like a folder.

7. Copy this GUID.

Recover GPO 6

Figure 6: Copy the GUID

Okay… now we have the GUID of the object we need to recover the rights too.
If you’re done with your coffee you should grap another one now and come back to part 3 afterwards!

Part 3 – Recover Procedure

1. Go to Start > Run.
In Server 2008 simply use “Search Programs and files” in the Start menu instead.

2. Type cmd and hit enter.

Recover GPO 7

Figure 7: Run CMD

3. Type the following command: dsacls cn=<GUID>,cn=policies,cn=system,dc=<domain>,dc=<domain>
Please notice that you should of course replace <GUID> with the one you copied from either part 1 or part 2 in this guide and that <domain> should be replaced with the name of your domain.
Example: cn={E44507AF-29F1-4057-8EDE-6A97A147AAA5},cn=Policies,cn=system,dc=contoso,dc=com

Recover GPO 8

Figure 8: Run the dsacls commandline tool

 

You’ll now be shown a list with 2 columns. First part lists the users and groups and the second column lists the permissions.
In the example provided here you should simply look for the word “Deny”.

Recover GPO 9

Figure 9: View Rights on the GPO

4. If the object has been denied for the specific group or user you can run the following command: dsacls cn=<GUID>,cn=policies,cn=system,dc=<domain>,dc=<domain> /R USER/GROUP
Please notice that you should of course replace <GUID> with the one you copied from either part 1 or part 2 in this guide and that <domain> should be replaced with the name of your domain.
Example: dsacls cn={E44507AF-29F1-4057-8EDE-6A97A147AAA5},cn=Policies,cn=system,dc=contoso,dc=com
/R “Authenticated Users”

5. It might be a good idea to give the user/group who were denied the object earlier some more rights to the object than just Read. You’ll have to adjust this to whatever you’re trying to recover in your environment.
Please type the following line: dsacls cn=<GUID>,cn=policies,cn=system,dc=<domain>,dc=<domain> /G USER/GROUP:GA
Please notice that you should of course replace <GUID> with the one you copied from either part 1 or part 2 in this guide and that <domain> should be replaced with the name of your domain. USER/GROUP should be replaced with the name of the user or group who were denied earlier.
Example: dsacls cn={E44507AF-29F1-4057-8EDE-6A97A147AAA5},cn=Policies,cn=system,dc=contoso,dc=com
/G “Authenticated Users”:GA

Recover GPO 8

Figure 10: Grant "Generic All" to Authenticated Users

5. Head back to the Group Policy Management Console and find the place where the GPO is linked to, or check the Group Policy Objects container.
It’s now possible to edit the group policy object again since rights has been “restored”.

Recover GPO 11

Figure 11: The GPO rights are now "restored".


I hope you enjoyed this little guide and that it might help you in your future work.