How to change the ACL of a file in Windows if I only know the SID?

I want to change the ACL of a file and set "full permissions" for a special user.

I know the cacls team cacls . /e /t /p Everyone:f

But this only works if the OS is English. For German systems, this should be cacls . /e /t /p Jeder:f.

I know the known SIDs of the user "all" (S-1-1-0), but it seems that I can not use them with cacls.

I have tried cacls . /e /t /p S-1-1-0:f.

Is there a way to use the Windows command line tools for these tasks? I am not allowed to bind software or other command line tools for this to work with my software.

The solution should be called from the Java process, but this should not be a problem.

+1
source share
2 answers

I have found a solution. I am using the library from the provider of my installation creation tool.

change

The solution of the problem:

The setup-creation tool Install4jhas a method getUserLogin(String sid), its return value is something like:WORKSTATION1\User1

I used caclsto change the ACL.

0
source

It may be a Windows version, but look

 whoami /groups

and analyze the result. On Windows 7, this

 whoami /groups | find "S-1-1-0"

looks like this to me

C:\>whoami /groups | find "S-1-1-0"
Everyone                                  Well-known group S-1-1-0
                     Mandatory group, Enabled by default, Enabled group

There is a whole Win32 API for this. Here's a solution using this from C #

http://www.ms-news.net/f2438/setpermission-everyone-c-4997971.html

+1
source

Source: https://habr.com/ru/post/1786383/


All Articles