Hi,
I have written a WIN32 application to get all the users that own files on a
WINNT system using GetFileSecurity() + GetSecurityDescriptorOwner() APIs.
Then I get all the groups that this user belongs to using the API
NetUserGetLocalGroups() for each of the users obtained in the first step.
The output which I am displaying as 4 columns namely userId, username,
groupId and groupName. For fileowners of type "group", the groupId and
groupName are kept the same as userId and userName respectively. Now my
confusion arises because there are a lot of users with the same name (domain
- username) with a different Sid. e.g. PERSISTENT\siddharth_aggarwal. has 6
entries below (even though there are only 2 unique groups that this user
belongs to: namely - BUILTIN\Administrators and BUILTIN\Users). So I am not
really sure why we have a different Sid for 2 user whose domainname+userName
is the same. i.e. Can the same user have 2 different Sid values?
Any pointers in this regard would be really helpful.
Thanks,
Siddharth
Attached output
UserID User Name
GroupID GroupName
S-1-1-0 \Everyone
S-1-1-0 \Everyone
S-1-5-21-1443438718-1192457488-1338337383-1015
PERSISTENT\siddharth_aggarwal S-1-5-32-544
BUILTIN\Administrators
S-1-5-21-1443438718-1192457488-1338337383-1015
PERSISTENT\siddharth_aggarwal S-1-5-32-545
BUILTIN\Users
S-1-5-21-1443438718-1192457488-1338337383-1318
PERSISTENT\siddharth_aggarwal S-1-5-32-544
BUILTIN\Administrators
S-1-5-21-1443438718-1192457488-1338337383-1318
PERSISTENT\siddharth_aggarwal S-1-5-32-545
BUILTIN\Users
S-1-5-21-1887572776-755525552-1806196434-1006 SANDIEGO\persist
S-1-5-32-545 BUILTIN\Users
S-1-5-21-1887572776-755525552-1806196434-500 SANDIEGO\Administrator
S-1-5-21-1887572776-755525552-1806196434-1007 SANDIEGO\ORA_DBA
S-1-5-21-1887572776-755525552-1806196434-500 SANDIEGO\Administrator
S-1-5-21-1887572776-755525552-1806196434-1010 SANDIEGO\se
S-1-5-21-1887572776-755525552-1806196434-500 SANDIEGO\Administrator
S-1-5-32-544 BUILTIN\Administrators
S-1-5-21-2000478354-299502267-725345543-2889 PERSISTENT\siddharth_aggarwal
S-1-5-32-544 BUILTIN\Administrators
S-1-5-21-2000478354-299502267-725345543-2889 PERSISTENT\siddharth_aggarwal
S-1-5-32-545 BUILTIN\Users
S-1-5-32-544 BUILTIN\Administrators
S-1-5-32-544 BUILTIN\Administrators