How do users' SIDs work?

1

I need to implement an authentication system written in C # .NET based on Windows users, so it will be authenticated according to some unique user identification p>

The problem is that the only workable ID I've encountered that might represent a user is SID, but I have a few minor questions about it:

  • Will a SID of a user logged into the Microsoft Live account be the same SID if it is connected to other machines?
  • Is a SID generated randomly for a local user?
  • If the first question is no, and the SID is just a local user identifier for the machine , how can I get an ID whose is unique to a Microsoft Live account, and to a local account?

This is the code used to get the SID of the user that is logged in to the machine :

WindowsIdentity user = WindowsIdentity.GetCurrent();
SecurityIdentifier sid = user.User;
    
asked by anonymous 20.09.2017 / 07:47

1 answer

1
  

A SID of a logged-in user in the Microsoft Live account will be the same   SID if it is connected to other machines?

Yes. To prove this there is even a command that allows you to search for the SID of a windows user:

wmic useraccount where name="user" get sid

Font

I tried to run this command for a user who never logged in to my computer and returned me a SID.

  

Is a SID randomly generated for a local user?

I do not have the slightest idea.

If you have problems, you can always use the Name property of the object WindowsIdentity

WindowsIdentity user = WindowsIdentity.GetCurrent();
user.Name
    
26.09.2017 / 18:18