[jcifs] problem browsing through smb://

Michael B Allen ioplex at gmail.com
Thu Aug 6 11:47:28 MDT 2009


On Thu, Aug 6, 2009 at 10:44 AM, Shuvankar
Mukherjee<shuvankr at hotmail.com> wrote:
> Hello,
>
> I am trying to get browse through "smb://" for a listing of Domains and
> Workgroup present in the network.
>
> // code segment start
>
>         NtlmAuthenticator.setDefault( this );
>
>         String smbURL= "smb://";
>
>        SmbFile file = new SmbFile( smbURL );

Hi Shuvankar,

Try this:

  SmbFile file = new SmbFile(smbURL, NtlmPasswordAuthentication.ANONYMOUS);

>        SmbFile[] files =file.listFiles();          // <---- This line is
> generating "access is denied "   exception
>          for( int i = 0; i < files.length; i++ ) {
>                       // listing the networks/workgroups
>             }
>
> // code segment start
>
> This code works nicely at one server on my network while in another server
> in another network it is throwing AccessException.
>
>
> Aug 06, 2009 09:34:01 AM [INFO] : [ERROR] Exception MessageAccess is denied.
>
>
> The user used in the NTLMAuthenticator is a domain user and when logged in
> to the server with the same user name, it can browse the whole network from
> Windows explorer.
>
> The user account used here is a domain admin account. What role should I set
> this user so that the list of workgroups come up like it used to?

I think the error is pretty accurate and indicates that the server
acting as the "master browser" simply does not accept those
credentials. It's probably a Samba server that is not joined to the
domain.

Note that the "browse" service is not used much anymore and should not
be relied on. But if it is available, usually the "ANONYMOUS" identity
is sufficient to list domains and workgroups.

Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/


More information about the jcifs mailing list