How to set file permissions?

(imported topic written by SA65)

Hello,

I need to set permissions to a file on all my system.

Does anyone know how to accomplish this?

Thanks,

SA

(imported comment written by BenKus)

Hey SA,

Windows (2000 and XP… maybe more) comes with a utility called “cacls.exe” (Change Access Control Lists). You can run this through BES if you would like.

For instance, imagine I want to grant “Everyone” “Read” access to “C:\test.txt”. I can create an action in BES like this (BES 6.0+ specific action):

waithidden cmd.exe /C cacls.exe C:\test.txt /E /G Everyone:R

(imported comment written by SA65)

That worked! Thanks!!!

SA

(imported comment written by SystemAdmin)

Ben,

Would this work as well to set permissions to a certain directory?

(imported comment written by jessewk)

Yes, the cacls tool will work on directories.

(imported comment written by SystemAdmin)

I am having difficulties when attempting to set folder permissions on servers and workstations running Windows 2000/XP/2003.

Here is my Action:

waithidden cmd.exe /C cacls.exe c:\windows\repair"}" /G Administrators:F /G System:F - this works great, but…

If I try:

waithidden cmd.exe /C cacls.exe “{escape of “%25windir%25\repair”}” /G Administrators:F /G System:F - to target either “C:\Windows” or “C:\WINNT”, it completes but the permissions are not set.

I have also tried deploying XCACLS.vbs in conjunction with:

dos “cscript c:\windows\system32\xcacls.vbs c:\windows\repair /G Administrators:F /G System:F” - again if targeted specifically they work but I would like to fix them both at once. Can some one show me what I am doing wrong? Thank you.

(imported comment written by BenKus)

Try changing:

{escape of “%25windir%25\repair”}

to

{pathname of windows folder}\repair

OR

{expand environment string of “%25Windir%25\repair”}

(I prefer the former over the latter…)

Ben

(imported comment written by SystemAdmin)

Ben,

That was the solution I was looking for, thank you.