[jcifs] SmbAuthException while calling list() on a SmbFile("smb://").

Michael P. Jung suriver at gmail.com
Mon Sep 6 21:00:44 GMT 2004

I guess there is something wrong with my configuration of jcifs. The
console smbclient and gnome-vfs with smb work without any problems

I got a IA32 (i386) box running Debian GNU/Linux Sarge (Testing) with
some packages from Sid (Unstable). The machine is running SAMBA 3.0.6
which is configured for security=share.

> Well we haven't had any reports of problems so apparently the master
> browser that you're querying does indeed require a valid usernmae and
> password.

Is there a way to specify the master browser? 

btw. here is the complete code which I use here at the moment...

package lx.intranet.scanner;

import jcifs.smb.SmbFile;

public class SmbScanner {
    public static void main(String[] args) throws Exception {
        jcifs.Config.setProperty("jcifs.netbios.hostname", "lx_scanner");
        jcifs.Config.setProperty("jcifs.util.loglevel", "3");
        SmbFile smb = null;
        smb = new SmbFile("smb://");
        SmbFile[] files = smb.listFiles();
        for (int i=files.length-1; i>=0; i--) {

And the stacktrace:

Exception in thread "main" jcifs.smb.SmbAuthException: Logon failure:
unknown user name or bad password.
	at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:192)
	at jcifs.smb.SmbSession.send(SmbSession.java:148)
	at jcifs.smb.SmbTree.treeConnect(SmbTree.java:134)
	at jcifs.smb.SmbFile.connect(SmbFile.java:833)
	at jcifs.smb.SmbFile.connect0(SmbFile.java:796)
	at jcifs.smb.SmbFile.doNetEnum(SmbFile.java:1617)
	at jcifs.smb.SmbFile.listFiles(SmbFile.java:1587)
	at jcifs.smb.SmbFile.listFiles(SmbFile.java:1497)
	at lx.intranet.scanner.SmbScanner.main(SmbScanner.java:21)

> Again, turn on logging, determine which machine is master browser,
> and try to query it directly.

I set the loglevel property to 3 but nothing shows up on stdout. When
trying to access my machine directly smb://brain/ and
smb://brain/public/ just the same exception is thrown. I know that the
machine requires no password to access the shares as it's frequently
used for Windows 2000 and Windows 98 boxes that are in no domain at
all. - Nope, it really requires no password - not even for the one
share. ;-)

SAMBA seams to recognize the browsing attempt, but doesn't state
anything useful in the log.

[2004/09/06 22:33:08, 1] smbd/service.c:make_connection_snum(648)
  lx_scanner ( connect to service incoming initially as
user nobody (uid=65534, gid=65534) (pid 10302)
[2004/09/06 22:33:08, 1] smbd/service.c:close_cnum(837)
  lx_scanner ( closed connection to service incoming

I also checked my iptables. They're empty and all default policies are
set to ACCEPT.

Any further ideas? (What's the best way to log the protocol between
the Java application and my SAMBA server? tcpdump, ettereal, ettercap
or some Java Socket hookup?


More information about the jcifs mailing list