[jcifs] authentication against workgroup & not domain possible?

Eric Glass eric.glass at gmail.com
Wed Sep 1 12:21:17 GMT 2004


> Is it possible to authenticate against a workgroup instead of a domain?
> The following:
>        InetAddress ip = InetAddress.getByName("localhost"); // ip
> address of your windows controller
>        UniAddress myDomain = new UniAddress(ip);
>        NtlmPasswordAuthentication auth = new
> NtlmPasswordAuthentication("MyWorgkroup", "stefaan", "");
>        SmbSession.logon(myDomain, auth);

Not really, but kind of.  A domain is really just a workgroup with a
central authentication store (the domain controller).  Accounts exists
within the SAM database on a particular server.  When a machine joins
a domain, it effectively allows it to delegate authentication to the
SAM on the domain controller machine.  In your example, the "stefaan"
account would be a local account on one or more machines in the
workgroup.  You should be able to do:

    auth = new NtlmPasswordAuthentication("MYMACHINE", "stefaan", "");

where MYMACHINE is the name of a machine having that account.  You
should also be able to just do:

    auth = new NtlmPasswordAuthentication("", "stefaan", "");

The machine name doesn't really matter in a workgroup setting; so long
as the target machine that you are connecting to has a local account
with a matching username and password, the authentication should
succeed.  But there's no concept of authenticating against a
workgroup; that concept is more or less the definition of a domain.


Eric


More information about the jcifs mailing list