Skip to content
Advertisement

Python ldap3 code to get username from SID

I have a SID string (e.g., “S-1-5-21-500000003-1000000000-1000000003-1001”) of a user on a shared Windows server, and I need to get the related username.

I suppose that this may be achieved by:

  1. Turning the SID string into byte array.
  2. Using a suitable ldpa query to get the related username.

But I failed to find exact and reliable instructions of how to do it (this way or another).

I’ll appreciate any useful guide, especially if it comes with demo Python (ldap3) code.

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement