Remove all ACL with SETACL on a folder then remove the inheritable permissions on it

Posted by Admin Sunday, November 22, 2009 5:11:46 PM Categories: _Tous les articles Windows 2003
Rate this Content 0 Votes

Howto
How remove all ACL on a folder, then remove the "inheritable" permissions, then set "special" ACL's on it.
To do that il use the application "SETACL" from "Source Forge.NET"

REM Add permissions (no recursion)
%WINDIR%\SYSTEM32\CMD.EXE /C ECHO Y|%WINDIR%\SYSTEM32\CACLS.EXE "C:\TEST" /E /C /G "MyUser":R

REM Reset permissions (recursion)
%WINDIR%\SYSTEM32\CMD.EXE /C ECHO Y|%WINDIR%\SYSTEM32\CACLS.EXE "C:\TEST\TEST2" /T /C /G "MyUser":R

REM remove "heritable" to allow SetAcl to work
setacl.exe -on "C:\TEST\TEST2" -actn setprot -op "dacl:p_nc;sacl:p_nc" -ot file

REM Set Generic Folder Special Permissions ONLY in folder
setacl.exe -on "C:\TEST\TEST2" -ot file -actn ace -ace "n:MyUser;p:read_ex,add_file,add_subdir,del_child"

 

Simple-Tech.info
Comments are closed on this post.
Site Map | Printable View | © 2008 - 2012 Simple-Tech.info | Powered by mojoPortal | HTML 5 | CSS | Design by mitchinson