1

I've messed up my file permissions on my home directory. Here's a small sampling of the output from AccessEnum

enter image description here

How can I fix this so that there's one set of rational permissions, that is

Read and Write for on c:\users\scott (recursively) for Administrators and my own account?

Command line solutions preferred.

3

Give the Administrators group ownership of the directory...

TakeOwn.exe /f "C:\Users\Scott" /a /r /d y

Grant Administrators and Scott full control.

cacls.exe "C:\Users\Scott" /t /c /g Administrators:F
cacls.exe "C:\Users\Scott" /t /c /e /g Scott:F

Note the double quotes aren't necessary in this case. I do it out of habit.

Update: The line to give Administrators full control doesn't seem to be necessary. TakeOwn apparently does that while it's changing the ownership.

5
  • This helped, but isn't ideal as it sets explicit permissions on each object. – Scott Weinstein Nov 19 '11 at 19:47
  • You could use icacls.exe instead. That is, remove the /t switches from the cacls commands above, so they don't process child items. Then do something like: for /f %a in ('dir C:\Users\Scott /a-l /b') do @icacls "C:\Users\Scott\%a" /reset /t /l /c – Patrick Seymour Nov 19 '11 at 23:13
  • @ScottWeinstein What would be better than setting explicit permissions on each object? – endolith Nov 9 '15 at 1:25
  • shouldn't subdirectories of a user's home be owned by that user? – endolith Nov 9 '15 at 1:31
  • I think what Scott was saying is that the folders and files inside the profile should inherit permissions from the root profile directory, rather than having explicit permissions set on them. In that case, you would use the icacls method in my comment. – Patrick Seymour Nov 9 '15 at 19:13
2

I had a variation on this problem: 3 files in a random directory were suddenly unavailable, couldn't be opened, deleted, or have their permissions changed. Using a variation of Patrick S. response worked for me:

takeown /F "MyLockedFile"
icacls "MyLockedFile" /reset
-2

Do a repair install (inplace upgrade) of Windows. Make sure you back up first. Also, you will need to reinstall all updates and maybe some programs.

7
  • 1
    Doesn't this have a lot of side effects? – Tamara Wijsman Nov 19 '11 at 19:18
  • Please specify what you mean by side effects. – kinokijuf Nov 19 '11 at 19:35
  • A side effect is an effect that is secondary to the one intended. – Tamara Wijsman Nov 19 '11 at 19:38
  • 1
    You will need to reinstall all updates and maybe some programs. Also, you’d better back up. – kinokijuf Nov 19 '11 at 19:55
  • 1
    I'm looking for something way simpler and more targeted. – Scott Weinstein Nov 20 '11 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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