[jcifs] Cannot connect with jcifs-1.3.3

Jonne Zutt jonne.zutt.ml at gmail.com
Mon Feb 16 11:16:43 GMT 2009


Dear JCifs users,

Today I downloaded the newest version of JCifs and tried to get it to
work with a small example program (we were using an old version,
and sometimes have some connection problems, so I thought it would be
a good idea to try to upgrade).
(In the past, we were using jcifs-1.1.11, and I did not find any
special things or properties we're using there).

However, I cannot get the new version to work. Hopefully, somebody can
help me how to figure out what properties I have to set,
or what I'm doing wrong.

I'm running the following example Java class, with jcifs-1.3.3.jar in
the classpath:

    public static void main(String[] args) {

    	jcifs.Config.setProperty("jcifs.util.loglevel", "N");
    	
    	jcifs.Config.setProperty("jcifs.smb.client.domain", "FILESERVER");
    	jcifs.Config.setProperty("jcifs.smb.client.username", "myusername");
    	jcifs.Config.setProperty("jcifs.smb.client.password", "mypassword");
    	
    	jcifs.Config.setProperty("jcifs.smb.client.disablePlainTextPasswords",
"false");

		try {
			SmbFile smbFile40 = new SmbFile("smb://fileserver.xxx.nl/");
			log.debug("40 exists: " + smbFile40.exists()); // -> prints true
			SmbFile smbFile41 = new SmbFile("smb://fileserver.xxx.nl/My Test/");
			log.debug("41 exists: " + smbFile41.exists()); // -> exists()
raises exception
			SmbFile smbFile42 = new SmbFile("smb://fileserver.xxx.nl/My
Test/documenten");
			log.debug("42 exists: " + smbFile42.exists());
		} catch (Exception ex) {
			log.error("", ex);
		}

    }

The output of the program is:

DEBUG 2009-02-16 12:06:43  nl.xxx.myproject.util.SmbUtil [393] - 40 exists: true
ERROR 2009-02-16 12:07:13  nl.xxx.myproject.util.SmbUtil [399] -
jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad password.
	at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:522)
	at jcifs.smb.SmbTransport.send(SmbTransport.java:644)
	at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:371)
	at jcifs.smb.SmbSession.send(SmbSession.java:235)
	at jcifs.smb.SmbTree.treeConnect(SmbTree.java:161)
	at jcifs.smb.SmbFile.doConnect(SmbFile.java:858)
	at jcifs.smb.SmbFile.connect(SmbFile.java:901)
	at jcifs.smb.SmbFile.connect0(SmbFile.java:827)
	at jcifs.smb.SmbFile.exists(SmbFile.java:1360)
	at nl.xxx.myproject.util.SmbUtil.main(SmbUtil.java:395)


I am able to connect from the command line, so I'm sure the password is correct
and the directories do exist.

$ smbclient -U myusername '//fileserver.xxx.nl/My Test'
Password:
Domain=[FILESERVER] OS=[Unix] Server=[Samba 3.0.10]
smb: \> ls
  .                                   D        0  Fri Aug 22 10:46:02 2008
  ..                                  D        0  Wed May 30 00:41:22 2007
  .DS_Store                           H    12292  Mon Feb 16 09:32:46 2009
  .TemporaryItems                    DH        0  Tue Nov 13 16:27:40 2007
  backup                              D        0  Fri Feb 22 15:23:19 2008
  CVs                                 D        0  Fri Jun 27 10:52:50 2008
  documenten                          D        0  Wed Aug  8 14:16:36 2007
  drivers                             D        0  Thu Aug 23 11:20:46 2007
  Fotos                               D        0  Fri Mar  7 10:07:30 2008
  My Systeembeheer                   D        0  Thu Aug 21 14:58:19 2008
  temp                                D        0  Mon Oct 13 10:24:08 2008

		55196 blocks of size 16777216. 41089 blocks available
smb: \>

Finally, here is some information that is in the /etc/smb.conf on the
fileserver and might be relevant.

[global]
        encrypt passwords = yes
        workgroup = WGROUP
        display charset = UTF-8-MAC
        security = user
        deadtime = 5
        guest account = unknown
        client ntlmv2 auth = no
        preferred master = no
        defer sharing violations = no
        allow trusted domains = no
        netbios name = fileserver
        lanman auth = YES
        vfs objects = darwin_acls
        wins support = yes
        brlm = yes
        max smbd processes = 0
        server string = The File Server
        os level = 8
        domain logons = no
        passdb backend = opendirectorysam guest
        dos charset = CP437
        unix charset = UTF-8-MAC
        auth methods = guest opendirectory
        local master = no
        domain master = no
        map to guest = Never
        use spnego = yes
        printer admin = @admin, @staff
        ntlm auth = YES
        log level = 1
[My Test]
        oplocks = 0
        map archive = no
        vfs objects = darwin_acls
        path = /Volumes/FileRaid/The Test
        read only = no
        strict locking = 1
        inherit permissions = 1
        comment = macosx
        create mask = 0644
        guest ok = 0
        directory mask = 0755

Thanks for any advice ;)
Jonne.


More information about the jcifs mailing list