NTLM + Jcifs SID.getGroupMemberSids()

Posted on 2008-11-10
Last Modified: 2013-12-02
Hi all,

Is it possible to use JCIFS to return all users from a Domain as well as all groups from that domain?

I have been studying the source code for jcifs 1.3.0 and found a class Inside, there are few interesting methods such as getGroupMemberSids.

I have been playing with the code but I did not make much progress. Any comments, suggestions, howtos, pointers, etc are greatly appreciated. Thanks.

import jcifs.UniAddress;

import jcifs.smb.NtlmPasswordAuthentication;

import jcifs.smb.SmbSession;

import jcifs.smb.NtlmContext;

import jcifs.ntlmssp.NtlmFlags;

import jcifs.smb.SID;


public class simpleJavaAuthenticationTest {


	public static void main(String[] args) {

		try {

			InetAddress ip = InetAddress.getByName("");

			UniAddress myDomain = new UniAddress(ip);

			NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("test.mydomain","carlosscheidecker","test");

			SmbSession.logon(myDomain, auth);

			System.out.println("Hostname: "+ myDomain.getHostName());

			jcifs.smb.SID mySid = jcifs.smb.SID.getServerSid(myDomain.getHostName(), auth);

			System.out.println("Sid Domain Name: "+ auth.getName());

			System.out.println("Sid Domain SID: " +mySid.getDomainSid());

			SID[] groupMembers = mySid.getGroupMemberSids(auth.getName(), auth, SID.SID_TYPE_USER);

			System.out.println("Total SIDs = "+groupMembers.length);

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

				System.out.println("Sid["+i+"] GroupMembersSids: " +mySid.getAccountName());


		} catch (Exception e) {

			System.out.println("Exception : "+e.toString());





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

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    When the confidentiality and security of your data is a must, trust the highly encrypted cloud fax portfolio used by 12 million businesses worldwide, including nearly half of the Fortune 500.
    Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 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

    10 Experts available now in Live!

    Get 1:1 Help Now