Archive: AccessControl: Setting permissions to "Domain Users" without knowing the domain name


AccessControl: Setting permissions to "Domain Users" without knowing the domain name
Hi,

I want to be able to set write permissions on a file to the "Domain Users" account, but without knowing the domain name in advance (or even that I'm in a domain at all).

I've seen in the AccessControl plugin documentation that I could use the SID (S-1-5-domain-513), but I still would need to know the domain the current user is logged onto. Is there an easy way to do that?

I found in another thread about a system call to LookupAccountSid which would also return the domain name, but I need the current user SID to do that and I don't know how to get it either.


Are you saying the account name is fixed, or 'Domain' is replaced with the name of the default domain?

Stu


Well, the installer should work in various environments, including with a domain (I don't have one).

Wat I want to do is: if the user launching the script is logged on to a domain, whichever it is, all users of that domain should get write permissions on a particular file.

Thus the domain name is not known at compile time, and should be found somehow at runtime, from the current user I guess.


what about the Authenticated Users group?


I found in another thread about a system call to LookupAccountSid which would also return the domain name, but I need the current user SID to do that and I don't know how to get it either.
LookupAccountName accepts a username and returns its SID and (optionally) the domain name

Have a look at the Network management functions, maybe you can find something better though ...
CF

Next version of AccessControl has NameToSid (and SidToName) in it.

Stu