How to copy file from smb share to local drive using jcifs in Java?

前端 未结 5 1702
后悔当初
后悔当初 2020-12-06 19:07

Could anybody help me to copy file from shared folder to local drive? My code is:

import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
impo         


        
5条回答
  •  太阳男子
    2020-12-06 19:39

    This is for clarification. "Logon failure: unknown user name or bad password." can show for example when you use 1.3.18 but not in 1.2.25. it is probably because different compatibility settings:

    1. jcifs.smb.lmCompatibility = 0 or 1: Send LM and NTLM 2)
    2. jcifs.smb.lmCompatibility = 2: Send NTLM in both fields 3)
    3. jcifs.smb.lmCompatibility = 3, 4, or 5: Send just LMv2

    First way is to use it before NtlmPasswordAuthentication

    jcifs.Config.setProperty( "jcifs.smb.lmCompatibility", "3");

    It can resolve this issue.

提交回复
热议问题