1

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

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

But this only works if the OS is english. For german systems, it must be cacls . /e /t /p Jeder:f.

I know the well-known SIDs of the user "everyone" (S-1-1-0), but it seems as if I can't use them with cacls.

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

Is there a way to use windows command line tools for this jobs? I'm not allowed to bundle software or other commandline tools for this job with my software.

The solution has to be called from a Java-Process, but that should not be a problem.

Christian Kuetbach
  • 15,850
  • 5
  • 43
  • 79
  • 1
    cacls cannot work with SIDs. If you're calling it from Java, why not convert the SID to a User in your program before invoking cacls? – Luke Dec 08 '10 at 17:15

2 Answers2

1

This might be Windows version specific, but look at

 whoami /groups

and parse the result. On Windows 7, this

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

looks like this for 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's a whole Win32 API for getting at this. Here's a solution using that from C#

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

Lou Franco
  • 87,846
  • 14
  • 132
  • 192
0

I found a solution. I am using a library from the vendor of my Setup creation tool.

edit:

Solution for problem:

The Setup-Creation Tool Install4j has a method getUserLogin(String sid) its returnvalue is something like: WORKSTATION1\User1

I used cacls to change the ACL.

Christian Kuetbach
  • 15,850
  • 5
  • 43
  • 79
  • How about telling us what the solution is so that this post has some value. Otherwise we might as well just close and delete it. – David Heffernan Jan 14 '11 at 15:13