File permissions

I recently formatted my machine and did a clean Windows 7 64-bit install. After I finished all of the files and folders on all my other drives kept giving me permissions BS and still are. I can manually go through and reset the owner and then give myself permissions but I have hundreds of thousands of files and folders, each needing to be reset for some reason. I know about "icacls" but don't really know how to use it. If anyone could post an "icacls" script to make "user" owner of all sub-folders and files on a drive, or tell me about another way to do it, that would make my day :D.

For example, I ran command prompt as administrator and entered "icacls d: /grant (username):(F) /t /c" and it and it spent quite a long time spitting out the name of every file I have on D drive and saying "access denied".
4 answers Last reply
More about file permissions
  1. That's what I did with "icacls d: /grant (username):F /t /c" and that just says that "access denied". If I manually go through and take ownership (right click, properties, security, advanced, owner, edit) then use icacls, everything is fine, the problem is, there is about 700000 files it says it can't access. If I use icacls /setowner, I get the same thing. That "takeown /f (file) does the exact same thing.
  2. In the example I linked to, they did not pick a simple directory, they listed the full drive. Remember, d:\ is not the same as d:

    From the listing:

    takeown /f (full path of your file)

    In my case because I wanted to take control of my D: drive I typed:
    takeown /f d:
  3. Fixed. When I tried to use inherited permissions on a folder, every file in it said I don't have permission to set permissions, so I thought using inherited ownership wouldn't work either, but it does. So I set ownership on D: and set it to "replace owner on sub-containers and contents" and then let icacls loose to set permissions on everything on D: (icacls D: /grant (USER NAME):F /t /c).

    "takeown /f" only took ownership of the folder/drive specified, not it's sub-folders (I think).
Ask a new question

Read More

Configuration Windows 7 Permissions