[jcifs] SmbFile: logon to Workgroup PC share fails

Jean-Marc Autexier jmau2002 at web.de
Wed Dec 16 08:56:55 MST 2009


I'm trying to access a share on a workgroup PC which is NOT in my domain. The logon fails.

Sample code:

NtlmPasswordAuthentication ntlmauth = new NtlmPasswordAuthentication("MYWORKGROUP","MyUser","password");
SmbFile to1 = new SmbFile( "smb://serverIP/share/filename.txt", ntlmauth);
System.out.println("Exist: "+to1.exists());

In exist() I get the following error:

Exception in thread "main" jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad password.
	at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:375)
	at jcifs.smb.SmbSession.send(SmbSession.java:217)
	at jcifs.smb.SmbTree.treeConnect(SmbTree.java:161)
	at jcifs.smb.SmbFile.doConnect(SmbFile.java:899)
	at jcifs.smb.SmbFile.connect(SmbFile.java:942)
	at jcifs.smb.SmbFile.connect0(SmbFile.java:868)
	at jcifs.smb.SmbFile.exists(SmbFile.java:1401)
Accessing the share with Windows explorer using MYWORKGROUP, MyUser and password works.

Instead of MYWORKGROUP I tried to use the hostname, didn't work either. 

Question: can I connect to a share on a Workgroup PC with jcifs?
If yes, what's wrong with my code?

Preisknaller: WEB.DE DSL Flatrate für nur 16,99 Euro/mtl.! 

More information about the jCIFS mailing list