What is the Windows equivalent to:

chown $USER
chmod 600 file

From what I understand, this requires that inherited permissions be disabled (because HOSTNAME\Users is inherited) and all groups outside of myself and Administrators be removed.

Can this operation be performed with takeown and icacls?

up vote 4 down vote accepted

Take ownership, so that the previous owner (if any) couldn't change permissions:

takedown /f filepath

Disable automatic inheritance:

icacls filepath /inheritance:d

Grant yourself full control:

icacls filepath /grant user:f

Finally remove everyone else:

icacls filepath /remove someotheruser

Anyone who is not listed in the ACL will be denied by default.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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