Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

There is a big, complex directory structure on a relative big NTFS partition. Somebody managed to put very bad security privileges onto it - there are directories with randomly given/denied permissions, etc. I already run into permission bugs multiple times, and I found insecure permission settings multiple times (for example, write permissions for "Everyone", or false owners).

I don't have time to check everything by hand (it is big).

But luckily, my wishes are very simple. The most common: read/write/execute on anything for me, and maybe read for Everyone.

Is it possible to somehow

  • remove all security data from a directory
  • and giving my (simple) wishes to overwrite everything there?

On Unix, I used a chown -R ..., chmod -R ... command sequence. What is its equivalent on Windows?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

NTFS is a bit more fine-grained than RWX, so for this example, I'm just resetting the ACLs to default. If you have a specific collection of ACEs, please add them to your question. Also, if the drive permissions themselves are mangled, we'd need to fix those as well.

Assuming the tree is rooted at D:\files:

REM Make local administrators group owner.
takeown /F D:\files /R /A /D Y

REM Reset ACLs to defaults.
icacls D:\files /reset /T /C /L /Q
share|improve this answer
    
Exactly this is what I wanted! Thank you! –  Peter Horvath Jun 6 at 16:14

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.