Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I change permissions for the folder including subfolders?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

If you don't want to do this from the GUI, you could use the command line program cacls using the /T option.

(or use icacls which is the new version of cacls).

If you want to use the GUI, right-click the folder, choose properties, then click the security tab. Click Advanced, then click Change Permissions. Add the user/group you want to give permissions to (and select the permissions you want to give), then check the box that says "Replace all child object permissions with inheritable permissions from this object".

UPDATE: Eating my own dog food, another real world scenario yesterday when we needed to reset all permissions on a folder with a few million files in it (and remove inheritance):

This was on Windows Server 2008 R2, so you need to run a CMD Prompt as Administrator (advisable for Server 2008 R2 and above). At the CMD prompt:

icacls E:\Store\*.* /grant:r "OURDOMAIN\Domain Admins":F /grant OURDOMAIN\ITAdmins:F /T /C /inheritance:r /Q

.

To explain each part of this command:

  • icacls
    • the command
  • E:\Store\*.*
    • the folder and files which need permissions reset
  • /grant:r
    • grant permissions and replace all existing permissions
  • "OURDOMAIN\Domain Admins"
    • user/group that we're giving permissions to (the quotes are needed because "Domain Admins" has a space)
  • :F
    • grant Full Access permissions
  • /grant
    • grant additional permissions (no need for :r this time)
  • OURDOMAIN\ITAdmins
    • an additional user/group to give permissions to
  • :F
    • grant Full Access permissions
  • /T
    • apply to subfolders too
  • /C
    • Continue on file errors (e.g. Access Denied)
  • /Q
    • Suppress all success messages i.e. don't tell me the millions of files that have the permissions applied, just tell me the ones which failed

For any files that fail, you may need to run TAKEOWN then run the icacls command again (on the failed files):

takeown /F E:\\Store /A /R /D Y

You may want to pipe output to a file because there isn't a "quiet" option on takeown.

Use takeown /? to see other options available.

share|improve this answer
    
Can I do this from the GUI? I couldn't find such option. –  Sergey Sep 30 '10 at 10:52
1  
@Sergey - I've added instructions for the GUI method. Hope this helps. –  misterjaytee Sep 30 '10 at 10:59
    
Thank you, it works! You finished a lot of painful hours of trying! –  Sergey Sep 30 '10 at 11:45

Simply Use :

ICACLS "PATH OF DIRECTORY (FOLDER)" /grant "USER":F /T

In Following example I am setting permission for Everyone to all sub-folders/files of a folder named Hardik in my D drive. then my cmd code would be like this,

ICACLS "D:\Hardik\*" /grant "Everyone":F /T

For more details please visit this link..

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.