纯文本密码被禁用 NetBios 远程连接

Plain text passwords are disabled NetBios remote connection

我正在尝试远程连接到 windows 机器并从此机器获取文件。 这是我的代码,

 path = path.replace(":","");
        path = path.replace("\","/");
        String smbpath="smb://"+host+":445/"+path; //c/alon2.txt";

        NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(user+":"+password);
        SmbFile smbFile = new SmbFile(smbpath,auth);

        SmbFileInputStream input = new SmbFileInputStream(smbFile);
        Files.copy(input, destPath.toPath());
        System.out.println("completed fetching file");
        return destPath;

我得到了这个例外,"Plain text passwords are disabled", 我试着把 jcifs.Config.setProperty("jcifs.smb.client.disablePlainTextPasswords","true"); 它不起作用,我不想禁用服务器中的 smb 第 3 方。 有什么想法吗?

java.lang.RuntimeException: Plain text passwords are disabled at jcifs.smb.SmbComTreeConnectAndX.writeParameterWordsWireFormat(SmbComTreeConnectAndX.java:129) at jcifs.smb.AndXServerMessageBlock.writeAndXWireFormat(AndXServerMessageBlock.java:94) at jcifs.smb.AndXServerMessageBlock.writeAndXWireFormat(AndXServerMessageBlock.java:166) at jcifs.smb.AndXServerMessageBlock.encode(AndXServerMessageBlock.java:65) at jcifs.smb.SmbTransport.doSend(SmbTransport.java:439) at jcifs.util.transport.Transport.sendrecv(Transport.java:67) at jcifs.smb.SmbTransport.send(SmbTransport.java:655) at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:316) at jcifs.smb.SmbSession.send(SmbSession.java:218) at jcifs.smb.SmbTree.treeConnect(SmbTree.java:176) at jcifs.smb.SmbSession.logon(SmbSession.java:147) at jcifs.smb.SmbSession.logon(SmbSession.java:140) at com.hp.autopass.usagehub.service.util.osutils.NetBiosConnection.authenticate(NetBiosConnection.java:47) at com.hp.autopass.usagehub.service.NetBiosConnectionTest.authenticateTest(NetBiosConnectionTest.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner.run(ParentRunner.java:290) at org.junit.runners.ParentRunner.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access[=11=]0(ParentRunner.java:58) at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)

你应该使用 jcifs.Config.setProperty("jcifs.smb.client.disablePlainTextPasswords","false"); 启用纯文本密码。在您的代码中,您将此标志设置为 true.