[jcifs] Cannot connect with jcifs-1.3.3
Michael B Allen
ioplex at gmail.com
Tue Feb 17 16:06:08 GMT 2009
On Tue, Feb 17, 2009 at 3:00 AM, Jonne Zutt <jonne.zutt.ml at gmail.com> wrote:
> Hi Mike,
>
>> The "N" in the documentation means some Number and not a literal "N".
> Thanks for that, I did try N=10, but it did not give me any output in
> my case, so then I tried the impossible :)
That sounds like a problem in and of itself. If the loglevel property
is being ignored, then perhaps your other properties are being ignored
as well.
Are you doing this within a webapp? Try examples/Exists.java from the
commandline.
>
> Thanks also for the hint about using encrypted passwords. I'll try to
> figure out how to do that next.
>
>> This setting could be a problem. JCIFS 1.3 uses NTLMv2 by default. Set
>> jcifs.lmCompatibility = 0 and jcifs.smb.client.useExtendedSecurity =
>> false so that NTLMv1 is used. Does that fix it?
>
> Unfortunately that did not help, I already tried. Neither did the %20
> instead of space help me, also already tried.
>
> Finally, I'll go and talk to the system administrators about all those
> samba settings. I don't know why the configuration
> is like it is, but they'll probably allow me to change the "client
> ntlmv2 auth = no" and try again.
>
> Thanks again for your help!
> Jonne.
>
> ps> I figured out my code runs fine with jcifs-1.1.11.jar as well as
> with jcifs-1.2.25. But still, I prefer to get the
> latest and greatest working ;)
Well the only major difference between 1.2 and 1.3 is NTLMv2.
Mike
>
>
> On Tue, Feb 17, 2009 at 5:20 AM, Michael B Allen <ioplex at gmail.com> wrote:
>> On Mon, Feb 16, 2009 at 6:16 AM, Jonne Zutt <jonne.zutt.ml at gmail.com> wrote:
>>> 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");
>>
>> The "N" in the documentation means some Number and not a literal "N".
>
> Thanks, a bit silly perhaps, I was a little confused by something I
> read somewhere.
> In my case, I already tried N=10 as well, but it didn't give any
> output, so I tried the
> impossible :)
>
>>> 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");
>>
>> I don't think 1.3 supports plain text passwords. 1.2 might but I have
>> not tried plain text passwords in a LONG time.
>
> Aha, that perhaps explains the "jcifs.smb.SmbAuthException: Logon
> failure: unknown user name or bad password.".
> Hmm while Googling I found somebody who got the error, something like,
> 'cannot use unencrypted passwords anymore', though.
> I'll try to figure out and test how to use encrypted passwords.
>
>>> 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
>>
>> What's the exception? Is it "unknown user name or bad password"? That is odd.
>>
>> Does it help if you use "smb://fileserver.xxx.nl/My%20Test/" instead?
>
> I already tried, it did not help :(
>
>>> 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
>>
>> This setting could be a problem. JCIFS 1.3 uses NTLMv2 by default. Set
>> jcifs.lmCompatibility = 0 and jcifs.smb.client.useExtendedSecurity =
>> false so that NTLMv1 is used. Does that fix it?
>>
>>> 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.
>>>
>>
>> Wow, those are some serious Samba configuration options. Do you really
>> know what all of those things do?
>>
>> Mike
>>
>> --
>> Michael B Allen
>> Java Active Directory Integration
>> http://www.ioplex.com/
>>
>
--
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/
More information about the jcifs
mailing list