Obtain the user SID with JCIFs/NTLM?

Posted on 2008-11-11
Last Modified: 2013-11-13

After authenticating an user via NTLM, how can I obtain the SID from the User, not the SID from the Domain?

Note the code snippet. I can obtain the Domain SID from the NtlmPasswordAuthentication object but I cannot get the current user domain SID which is what I would like to get to fetch all the group SIDs related to it.

Thanks in advance.

try {

			UniAddress myDomain = getPrimaryDomain(ip);

			NTLMAuth = new NtlmPasswordAuthentication(domainName,userName,password);

			SmbSession.logon(myDomain, NTLMAuth);

			// after loging in, here's how to get the SID for the Domain

                       jcifs.smb.SID mySid = jcifs.smb.SID.getServerSid(hostName, NTLMAuth);

                      // this returns something like 

                      // Sid Domain SID: S-1-5-21-796745780-2711697408-451074171

                      // trying to resolve SIDs this way DOES NOT work

                      SID[] sids = new SID[10];

			sids[0] = mySid; // assigns domain SID???


			jcifs.smb.SID.resolveSids(hostName, NTLMAuth, sids);


			for (int i = 0; i < sids.length; i++ ) {

				System.out.println("Sids["+i+"] Type: " +sids[i].getType());




		} catch (SmbException smbe) {

			System.out.println("Failed to Authenticate: "+smbe.getMessage()+" NTStatus: "+smbe.getNtStatus());

		} catch (Exception e) {

			System.out.println("Failed to Authenticate: "+e.getMessage());


Open in new window

Question by:CarlosScheidecker
    1 Comment
    LVL 1

    Accepted Solution

    Used LDAP for the needs I have as per talk with JCIFs developers. Not want I wanted but did the trick.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: Create Mobile App Prototypes with Adobe XD

    This is a project-based course: we go through all the steps of creating a prototype from start to finish, using all the tools and features currently available in Adobe XD. You can complete the course in less than a day, plus all project files and fonts are included.

    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now